Hi,
How can we use the down and up keys in vb.net using Keypress?Any one can help me? Pls.
The KeyPress event is not missing. If you want to get the ASCII code of the key pressed in the KeyPress event, use the KeyPressEventArgs' KeyChar property to get the Char representing the key pressed, and then convert it to an ASCII keycode using AscW. Also, if you want to determine whether a Char is numeric or alphabetic, you can use the IsNumber and IsLetter shared methods of Char. For example:
Code:
Private Sub frmGame_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles MyBase.KeyPress
Dim keyascii As Integer = AscW(e.KeyChar)
Dim bNumber As Boolean = Char.IsNumber(e.KeyChar)
Dim bLetter As Boolean = Char.IsLetter(e.KeyChar)
End Sub