sarthemaker
Active member
- Joined
- Sep 4, 2009
- Messages
- 36
- Programming Experience
- 5-10
I am trying to make buttons made during runtime with a click event. I have figured out the click event, by using addhandler, but is there a way to get info from the button, and use it in the sub? Here is my code:
Dim navbut As New Button
navbut.Text = SysRoot
navbut.Tag = SysRoot
AddHandler navbut.Click, AddressOf navPath_Click
navbut.Font = New Font("Lucidia Grande", 7, FontStyle.Bold)
navbut.FlatStyle = FlatStyle.Flat
navbut.FlatAppearance.BorderSize = 0
navbut.Location = New System.Drawing.Point(5, -1)
navbut.Parent = Panel4
Dim strsize As SizeF = Me.CreateGraphics.MeasureString(navbut.Text, navbut.Font)
navbut.Width = strsize.Width * 1.3 + 20
Private Sub navPath_Click()
Viewer.Items.Clear()
OpenDir(`I need the tag of the button that was clicked here`)
End Sub
the buttons will be created according to a variable that changes during runtime, so I won't know the names of the buttons.
Dim navbut As New Button
navbut.Text = SysRoot
navbut.Tag = SysRoot
AddHandler navbut.Click, AddressOf navPath_Click
navbut.Font = New Font("Lucidia Grande", 7, FontStyle.Bold)
navbut.FlatStyle = FlatStyle.Flat
navbut.FlatAppearance.BorderSize = 0
navbut.Location = New System.Drawing.Point(5, -1)
navbut.Parent = Panel4
Dim strsize As SizeF = Me.CreateGraphics.MeasureString(navbut.Text, navbut.Font)
navbut.Width = strsize.Width * 1.3 + 20
Private Sub navPath_Click()
Viewer.Items.Clear()
OpenDir(`I need the tag of the button that was clicked here`)
End Sub
the buttons will be created according to a variable that changes during runtime, so I won't know the names of the buttons.