A method to allow the user to enter only certain specific characters into a text box and ignore any other key. In this example only numbers, the Backspace key and the period will be allowed, everything else is ignored.
'allow only numbers, the Backspace key and the period
If (e.KeyChar < "0" OrElse e.KeyChar > "9") _
AndAlso e.KeyChar <> ControlChars.Back AndAlso e.KeyChar <> "." Then
'cancel keys
e.Handled = True
End If
Tuesday, December 9, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment