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
VB.NET - keyboard input
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:
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.
It should look some thing like VBK_SPACE or junk like that.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement