J
Jon Cosby
I'm trying to assign keys to a textbox. I've added a handler just for that
control. When I hit the keys, though, the values are entered in the active
textbox, not the one they're assigned to. Why is this?
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
AddHandler tb.KeyPress, AddressOf keypressed
End Sub
Private Sub keypressed(ByVal o As Object, ByVal e As KeyPressEventArgs)
If e.KeyChar = Microsoft.VisualBasic.ChrW(48) Then
e.Handled = True
ElseIf e.KeyChar = Microsoft.VisualBasic.ChrW(49) Then
e.Handled = True
...
tb.Text += e.KeyChar.ToString()
End Sub
control. When I hit the keys, though, the values are entered in the active
textbox, not the one they're assigned to. Why is this?
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
AddHandler tb.KeyPress, AddressOf keypressed
End Sub
Private Sub keypressed(ByVal o As Object, ByVal e As KeyPressEventArgs)
If e.KeyChar = Microsoft.VisualBasic.ChrW(48) Then
e.Handled = True
ElseIf e.KeyChar = Microsoft.VisualBasic.ChrW(49) Then
e.Handled = True
...
tb.Text += e.KeyChar.ToString()
End Sub