code_junkie

Trap Key Entries to Digits and Cap Alphas in Textbox

Nov 12th, 2011
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. Private Sub TextBox1_PreviewTextInput(ByVal sender As Object, ByVal e As System.Windows.Input.TextCompositionEventArgs) Handles TextBox1.PreviewTextInput
  2. Dim Character As Char = Convert.ToChar(e.Text)
  3. If Char.IsDigit(Character) Then
  4. e.Handled = False
  5. ElseIf Char.IsLetter(Character) And UCase(Character) = Character Then
  6. e.Handled = False
  7. Else
  8. e.Handled = True
  9. End If
  10.  
  11.  
  12. End Sub
Add Comment
Please, Sign In to add comment