0

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 :)

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by nore
1
Private 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 to Cut, Copy, Paste does not.

Votes + Comments
Good and easy
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.