[Gambas-user] How to make Textbox only accept alphabetic and numbers characters
Bruce
adamnt42 at gmail.com
Mon May 10 13:34:24 CEST 2021
On 10/5/21 8:54 pm, Hasan Merkit wrote:
> 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
>
Well that may work in VB.net but not here. Why would you think it would.
Gambas has an excellent help system, but as I have sais many times
before, you must read every word, every word and the every word. Try
reading the help for the TextBox control, in particular the events.
Sheesh! How many times do I have to reply to this same question.
Gambas is NOT Visual Basic
Gambas is not python
nor is it cobol, pascal, smalltalk or a small planet near Beetlegeuse.
You probably want TextBox.Change.
More information about the User
mailing list