Jump to content
  • Advertisement
Sign in to follow this  
rexTroianus

VB.NET - keyboard input

This topic is 5028 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!