Key is alphanum?

JumpyNET

Centurion
Joined
Apr 4, 2005
Messages
196
What is the shortest way to check if a pressed key is alphanumeric in a KeyDown event?

PS: I'm using VB2005 Express.
 
I've just tended to check with Char.IsLetterOrDigit

Ok, I tried this:
Code:
    Private Sub MyControl_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Lista.KeyDown

        Dim PressedChar As Char = Chr(e.KeyCode)
        If Char.IsLetterOrDigit(PressedChar) Then
            MsgBox("You pressed: " & PressedChar)
        End If

    End Sub

Odly the IsLetterOrDigit is true if I press any of the F#-keys. Can you suggest some other conversion method from key to char?
 
Back
Top