G
Guest
I have a RadioButton which executes some code on its MouseDown event.
I would like to use the same RadioButton's KeyPress event to trigger its own
MouseDown event when the Enter Key is pressed. I naively thought the
following would work:
Private Sub RadioButton7_KeyPress(ByVal sender As Object, ByVal e as
Windows.Systems.Forms.KeyPressEventArgs) Handles RadioButton7.KeyPress
If e.KeyChar=Microsoft.VisualBasic.ChrW(13) then
RadioButton7_MouseDown(Me,e)
End If
End Sub
but the second argument (the e) calls up an error as it is a KeyPress Event
and not a MouseEvent (as expected in the procedure that I am trying to
invoke). How can I pass across the correct e argument (i.e. MouseDown) to
invoke the RadioButton7_MouseDown event? The online coding assistant tells me
about raising the event but it isn't intuitively obvious to me (a VB4 oldie)
as to how to do this. I'm sorry if this is a stupid question but I am
stumped. Many thanks for any replies.
I would like to use the same RadioButton's KeyPress event to trigger its own
MouseDown event when the Enter Key is pressed. I naively thought the
following would work:
Private Sub RadioButton7_KeyPress(ByVal sender As Object, ByVal e as
Windows.Systems.Forms.KeyPressEventArgs) Handles RadioButton7.KeyPress
If e.KeyChar=Microsoft.VisualBasic.ChrW(13) then
RadioButton7_MouseDown(Me,e)
End If
End Sub
but the second argument (the e) calls up an error as it is a KeyPress Event
and not a MouseEvent (as expected in the procedure that I am trying to
invoke). How can I pass across the correct e argument (i.e. MouseDown) to
invoke the RadioButton7_MouseDown event? The online coding assistant tells me
about raising the event but it isn't intuitively obvious to me (a VB4 oldie)
as to how to do this. I'm sorry if this is a stupid question but I am
stumped. Many thanks for any replies.