Limiting TextBox Input

  • Thread starter Thread starter Developer Dude
  • Start date Start date
D

Developer Dude

Guest
Hi:

I have multiple textboxes in which I want to limit the input to the letters "A", "a", "C", "c" Or a Backspace. The textboxes

are identical and I have the same keypress handler for each one. It only works for the first textbox and not the others.

There is no other code of any kind at this point. Any ideas?

Thanks

Private Sub TxtSE_TYPE_1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtSE_TYPE_1.KeyPress

'Allow The Type 1 TextBox To Accept The Letters "A", "a", "C", "c" Or A Back Space.
If Not Asc(e.KeyChar) = 8 And Not Asc(e.KeyChar) = 32 And Not Asc(e.KeyChar) = 65 And Not Asc(e.KeyChar) = 67 _
And Not Asc(e.KeyChar) = 97 And Not Asc(e.KeyChar) = 99 Then

e.Handled = True

txtSE_TYPE_1.Select()

End If

End Sub

Continue reading...
 
Back
Top