fredfrothen
New member
- Joined
- Apr 16, 2013
- Messages
- 4
- Programming Experience
- Beginner
Hey guys, i'm a learner to vb.net, used to use vb6 a fair bit.
I'm stuck on a small project of mine, i'm loading a heap of buttons at start up and i then need to be able to handle the buttons click event.
For example when the button is clicked i would like a message box to appear displaying that specific buttons 'Text'.
Here's my code so far:
I'm stuck on a small project of mine, i'm loading a heap of buttons at start up and i then need to be able to handle the buttons click event.
For example when the button is clicked i would like a message box to appear displaying that specific buttons 'Text'.
Here's my code so far:
VB.NET:
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim i As Integer
For i = 0 To 50
Dim lol As New Button
Me.Controls.Add(lol)
lol.Width = 55
lol.Height = 22
lol.Text = "W " & i
If i <= 10 Then
lol.Left = 0
If i > 0 Then
lol.Top = 25 * i
End If
ElseIf i > 10 And i <= 20 Then
lol.Left = 80
End If
Next i
End Sub