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.
dc_24l
0
Newbie Poster
Recommended Answers
Jump to PostYou need to handle the keyascii in the keypress event .
Jump to Posttryb 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
All 5 Replies
debasisdas
580
Posting Genius
Featured Poster
dc_24l
0
Newbie Poster
debasisdas
580
Posting Genius
Featured Poster
dc_24l
0
Newbie Poster
debasisdas
580
Posting Genius
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.