[Gambas-user] How to make Textbox only accept alphabetic and numbers characters
Hasan Merkit
hasanmerkit at outlook.com
Mon May 10 13:24:23 CEST 2021
How i can make a textbox only accept alphabetic characters?
In VB.Net, i do this:
Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) _Handles txtName.KeyPress
If Not (Asc(e.KeyChar) = 8) Then
Dim allowedChars As String = "abcdefghijklmnopqrstuvwxyz0123456789"
If Not allowedChars.Contains(e.KeyChar.ToString.ToLower) Then
e.KeyChar = ChrW(0)
e.Handled = True
End If
End If
End Su
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210510/426ccce4/attachment.htm>
More information about the User
mailing list