H
Hrvoje Vrbanc
Hello all,
I'm relatively inexperienced with Windows Forms programming so I have one
question: what is the best way to dynamically add e.g. 100 buttons in 10 x
10 pattern, each button with different text (numbers from 1 to 100), but
with very similar event handlers (each time a certain number is compared
with the text of the button).
I have tried basically the following:
Dim i As Integer
Dim bt(10) As Button
For i = 1 To 10
bt(i).Size = New System.Drawing.Size(35, 25)
bt(i).Text = i
Me.Controls.Add(bt(i))
Next
There were some errors.
I would be grateful for any help!
Hrvoje
I'm relatively inexperienced with Windows Forms programming so I have one
question: what is the best way to dynamically add e.g. 100 buttons in 10 x
10 pattern, each button with different text (numbers from 1 to 100), but
with very similar event handlers (each time a certain number is compared
with the text of the button).
I have tried basically the following:
Dim i As Integer
Dim bt(10) As Button
For i = 1 To 10
bt(i).Size = New System.Drawing.Size(35, 25)
bt(i).Text = i
Me.Controls.Add(bt(i))
Next
There were some errors.
I would be grateful for any help!
Hrvoje