hey need some help guys. for example i have a text box and i will have input in it. but only numeric ones are allowed to be inputted in the text box if a character for example "a" is pressed the text box will not change and type the "a" and if a numeric button for example is 1, the text box will have 1. how can i do this? thanks.

You need to handle the keyascii in the keypress event .

how can i handle the ascii? can anyone make a sample code? i would really appreciate it thanks.

tryb to use this sample code for reference.

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii >= 97 And KeyAscii <= 122 Then
KeyAscii = 0
End If
End Sub

hey hello debasisdas. Thanks so much for the help :)

You are most welcome .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.