Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

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

Posted

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

Software bugs are impossible to detect by anybody except the end user.
Posted
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?

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...