Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array of Controls within an Array

Status
Not open for further replies.

itflash

Programmer
Jul 18, 2001
535
0
0
GB

Hi all

have a question regarding arrays.

I am in a specific situation and this requires a specific solution.

I am re-creating a grid and would like to hold controls in an array.

Therefore, the array has columns of textbox, checkbox (all pre-defined) and has rows of integer.

Have played around with this and the best solution is as follows:

Code:
Public Class Test_Array
  Public m_items As new ArrayList
End Class

Code:
Dim aa(3) As Test_Array
aa(0) = New Test_Array
For Each ctrl In Me.Controls
   aa(0).m_items.Add(ctrl)
Next

This works OK and is a simple example. But what I want to do is add the controls into the sub array by the following method:

Code:
aa(0).m_items(3).Add(ctrl)

But this does not work. Is there any way around this or another method I could use?

Thanks
ITflash




 
What you've written works fine, assuming you've declared ctrl as a Control in the 2nd and 3rd parts of your code.

What error are you getting exactly?


There's a thin line between genius, and insanity!
 

Thanks for the reply.

Sorry, got it all working fine now.

Thanks anyway.
ITflash

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top