P
PBSnake
Guest
I am trying to put several buttons at the buttom of a form. Then set it up so you can either click the button or press a function key to do the same as clicking the button. However with this .net Im having some troubles. Any suggestions? This is what I thought would work but it's not.
Public Class Form1
Inherits System.Windows.Forms.Form
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = "F1 has been pressed"
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Label2.Text = "F2 has Been pressed"
End Sub
Public Sub Form_Keydown(ByVal keycode As Integer, ByVal shift As Integer)
Select Case keycode
Case Windows.Forms.Keys.F1
Button1_Click()
Case Windows.Forms.Keys.F2
Button2_Click()
End Select
End Sub
End Class
Button1_Click(), Button2_Click() Is where the problem is. Do I have to declare thes somehow?
Thanks
PBSnake
Public Class Form1
Inherits System.Windows.Forms.Form
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = "F1 has been pressed"
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Label2.Text = "F2 has Been pressed"
End Sub
Public Sub Form_Keydown(ByVal keycode As Integer, ByVal shift As Integer)
Select Case keycode
Case Windows.Forms.Keys.F1
Button1_Click()
Case Windows.Forms.Keys.F2
Button2_Click()
End Select
End Sub
End Class
Button1_Click(), Button2_Click() Is where the problem is. Do I have to declare thes somehow?
Thanks
PBSnake