help... function keys  
Author Message
VBAddict





PostPosted: Visual Basic Express Edition, help... function keys Top

help plz....

e.Handled = True
If e.KeyChar = ChrW(70) & ChrW(53) Then
MessageBox.Show("Sample")
End If

this code was located at form1_keypress

when the user press F5, a message would pop-up. but it does not work...




Visual Studio Express Editions38  
 
 
DMan1





PostPosted: Visual Basic Express Edition, help... function keys Top

make sure you set the forms "KeyPreview" property to true

 
 
nobugz





PostPosted: Visual Basic Express Edition, help... function keys Top

F5 doesn't generate a KeyPressed event, use the KeyDown event instead:

Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.F5 Then
MsgBox("F5 pressed", MsgBoxStyle.OkOnly, "nobugz was here")
End If
End Sub