Hi, I would like to know how to set the textbox to only accept numbers, also that will only accept numbers 1,2 & 3 only.
Thanks in advanced. :icon_mrgreen:
i tried but i really don't know how.
Just trap the ascii code, So user only can input numbers. This following code just accept numbers input only : [CODE]Private Sub Text1_KeyPress(KeyAscii As Integer) Select Case KeyAscii Case 48 To 57, 8 '0-9 and backspace 'Let these key codes pass through Case Else 'All others get trapped KeyAscii = … Read More
[QUOTE]Anyways, May I ask, where should I insert the msgbox code so that everytime the user enters letters or other numbers except from 1,2 and 3 of course, a pop-up msg will show up telling that he entered "Invalid Code" ?[/QUOTE] Put in trapping case : [CODE]Private Sub Text1_KeyPress(KeyAscii As … Read More
Edited by StephNicolaou: n/a
Edited by Jx_Man: code added
Edited by abelingaw: n/a
Edited by Jx_Man: n/a