BustaCap Posted September 21, 2003 Posted September 21, 2003 I'm new to .net and can't figure out how to create a control array. :( Quote
*Experts* mutant Posted September 21, 2003 *Experts* Posted September 21, 2003 You can do it code but not in the designer. Code example: Dim Boxes(5) As TextBox dim x as Integer for x = 0 to 5 Boxes(x) = New TextBox 'set some properties Next x Quote
AlexCode Posted September 22, 2003 Posted September 22, 2003 Since the meanig of this forum is to help people I always like to add something I think may be missing... The only thing I'd like to add to the mutant post is that with this new ways of programming with .net and the real OOP language you can simply play with arrays like mutant put it, to simple questions, but you cal also take advatage of the ArrayList class that lets you put in it anything you wish... You can even create a Structure made of various Variables/Objects and put them on the array... real handy sometimes... Class C Public Property a() As Integer Get 'Code End Get Set(ByVal Value As Integer) 'Code End Set End Property Public Property b() As String Get 'Code End Get Set(ByVal Value As String) 'Code End Set End Property End Class Structure S Dim btn As System.Windows.Forms.Button Dim cb As System.Windows.Forms.ComboBox Dim i As Integer Dim myC As C End Structure Dim myArrayList As New ArrayList Public Sub mySaveMethod() Dim mybtn As New System.Windows.Forms.Button Dim mycb As New System.Windows.Forms.ComboBox Dim myC As New C Dim myStruct As New S With myStruct .btn = mybtn .cb = mycb .myC = myC .i = 10 End With myArrayList.Add(myStruct) End Sub Public Sub myReadMethod() Dim myStruct As New S For i As Integer = 0 To myArrayList.Count - 1 myStruct = myArrayList(i) 'And now you can have the values for each object in the structure! Next End Sub Quote Software bugs are impossible to detect by anybody except the end user.
Worrow Posted September 24, 2003 Posted September 24, 2003 I got the same question a while ago but with withevents control variaible. However, withevents control variable cannot be included into an array(how about arraylist?). So if I take away the 'withevent' keyword, what will I miss? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.