Hello all, i want to know some textbox case.
I want to make my textbox (example textbox1) only can be written by numeral, if there was non numeral input, textbox1 not allow or just being ignored.
Thanks for attention or help :)
nore
0
Light Poster
Recommended Answers
Jump to PostPrivate Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress Select Case e.KeyChar Case "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", vbBack '// numeric and backspace. Exit Sub Case Else e.Handled = True End Select End Sub
Should work.
Using shortcut keys …
All 3 Replies
kvprajapati
1,826
Posting Genius
Team Colleague
codeorder
197
Nearly a Posting Virtuoso
xfrolox
commented:
Good and easy
+1
nore
0
Light 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.