Hi, I've created a number buttons on a form dynamically.
I then setup handlers for MouseHover,MouseLeave, Click etc: See below:
Private Sub CreatebtnControls()
Dim answer As String
Dim index As Integer
answer = 5
For index = 1 To CInt(answer)
' Create the textbox
Dim Btn As New Button
Btn.Size = New System.Drawing.Size(400, 30)
Btn.Location = New System.Drawing.Point(50, 40 + index * 40)
'Btn.Visible = True
' we need this to identify the control
Btn.Name = "Btn #" & CStr(index)
' add to the controls collection
Me.Controls.Add(Btn)
' prepare event handlers
AddHandler Btn.MouseHover, AddressOf Btn_MouseHover
AddHandler Btn.MouseLeave, AddressOf Btn_MouseLeave
AddHandler Btn.GiveFeedback, AddressOf Btn_GiveFeedback
AddHandler Btn.Click, AddressOf Btn_Click
Next
End Sub
Private Sub Btn_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs)
Debug.WriteLine("Btn_MouseHover in " & CStr(CType(sender, Button).Name))
End Sub ....
For some reason MS didn't provide a gotfocus handler - i need this handler or something similar.
(When the user tabs from button to button the gotfocus event should be triggered and code execute...)
Does anyone one know of a workaround of method for implementing something like gotfocus.
Thanks for help in advance, Ken
I then setup handlers for MouseHover,MouseLeave, Click etc: See below:
Private Sub CreatebtnControls()
Dim answer As String
Dim index As Integer
answer = 5
For index = 1 To CInt(answer)
' Create the textbox
Dim Btn As New Button
Btn.Size = New System.Drawing.Size(400, 30)
Btn.Location = New System.Drawing.Point(50, 40 + index * 40)
'Btn.Visible = True
' we need this to identify the control
Btn.Name = "Btn #" & CStr(index)
' add to the controls collection
Me.Controls.Add(Btn)
' prepare event handlers
AddHandler Btn.MouseHover, AddressOf Btn_MouseHover
AddHandler Btn.MouseLeave, AddressOf Btn_MouseLeave
AddHandler Btn.GiveFeedback, AddressOf Btn_GiveFeedback
AddHandler Btn.Click, AddressOf Btn_Click
Next
End Sub
Private Sub Btn_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs)
Debug.WriteLine("Btn_MouseHover in " & CStr(CType(sender, Button).Name))
End Sub ....
For some reason MS didn't provide a gotfocus handler - i need this handler or something similar.
(When the user tabs from button to button the gotfocus event should be triggered and code execute...)
Does anyone one know of a workaround of method for implementing something like gotfocus.
Thanks for help in advance, Ken