VB.NET - keyboard input

Started by
0 comments, last by PnP Bios 19 years, 2 months ago
I am trying to manage the input from the keyboard. You know, when I press Down Arrow, message box appears. That is just an example. I managed it to work when you press ENTER. But what is with other keys? This is my code:
 Public Sub bb()
        ' Create a TextBox control.
        Dim tb As New TextBox
        Me.Controls.Add(tb)
        AddHandler tb.KeyPress, AddressOf keypressed
        AddHandler tb.KeyPress, AddressOf keypressed2
    End Sub 'New

    Sub keypressed(ByVal o As [Object], ByVal e As KeyPressEventArgs)
        If e.KeyChar = Microsoft.VisualBasic.ChrW(14) Then
            MsgBox("Pressed!", , "Pressed!")
        End If
    End Sub
Can anyone help me please? Thanks, -rex
Advertisement
It only looks like you are testing for character 14, which my guess would be enter. I would suggest diving into MSDN and looking for the keyboard enumerations.

It should look some thing like VBK_SPACE or junk like that.
HxRender | Cornerstone SDL TutorialsCurrently picking on: Hedos, Programmer One

This topic is closed to new replies.

Advertisement