Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Does anyone have idea to replace the 'Me.Controls.Add()' to 'Me.Controls.AddRange()' of the following code. I mean is it possible directly add the 'top' into the 'Me.Controls.AddRange()'

 

dim focus as ToolPanel
dim panels as new ArrayList
dim top as new ArrayList
....................
For Each focus In panels.ToArray
    focus.Minimize(DockStyle.Top)
    top.Add(focus)
Next
....................
For Each focus In top.ToArray : Me.Controls.Add(focus) : Next

Posted

philip:

You need to change top to a collection of Controls....I'll try to get the VB right: :p

 


Dim top(panels.Count) As Control
Dim count As Int32 = 0

For Each focus In panels.ToArray
   focus.Minimize(DockStyle.Top)
   top(count) = CType(focus, Control)
   count = (count + 1)
Next

Me.Controls.AddRange(top)

 

  Quote
Does anyone have idea to replace the 'Me.Controls.Add()' to 'Me.Controls.AddRange()' of the following code. I mean is it possible directly add the 'top' into the 'Me.Controls.AddRange()'

 

dim focus as ToolPanel
dim panels as new ArrayList
dim top as new ArrayList
....................
For Each focus In panels.ToArray
    focus.Minimize(DockStyle.Top)
    top.Add(focus)
Next
....................
For Each focus In top.ToArray : Me.Controls.Add(focus) : Next

Posted

You don't need to use AddRange, a control has a Controls Collection. Also, if your not using the top variable anywhere else, you don't need it.

 

Dim top As Control

 

For Each focus In panels.ToArray

focus.Minimize(DockStyle.Top)

top.Controls.Add(focus)

Next

 

Me.Controls.Add(top)

  • Leaders
Posted

How about

Me.Controls.AddRange(top.ToArray())

?

:)

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...