Sorry to break this to you, but this is pretty much a coding horror.
To create an
Array
of
TextBox
es the following would have sufficed:
Dim textBoxArray(2) As TextBox
textBoxArray(0) = New TextBox
All the
Properties
you have defined in your redundant (and horribly written)
TextBoxArray Class
are already
Properties
of the
Textbox
.
You can set them like this:
textBoxArray(0).Visible = False
textBoxArray.Location = New Point(20, 30)
Furthermore in your
For Loop
you create a new
Array
every time, making you lose your old
Array
(and references to it).
To get the
Text Property
of any one of the
TextBox
es, simply ask for it.
MessageBox.Show("TextBox1's text is: " & textBoxArray(0).Text)
This has nothing to do with
Events
(as your question title states).
To dynamically handle
Event
s use the
AddHandler
and
RemoveHandler
keywords.
AddHandler textBoxArray(0).TextChanged, AddressOf TextBox_TextChanged
RemoveHandler textBoxArray(0).TextChanged, AddressOf TextBox_TextChanged
Private Sub TextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
Your code above shows that you have not understood some basic programming rules.
I suggest you start reading up on things. Buy a book, read some tutorials and articles on the internet (CodeProject is a good place to start!).
Hope it helps and good luck!