I want to validate a textbox so that only numeric values can be inserted in to it.
This validation should done while user enters the values.
For example.
Consider following keys had been pressed in a sequence

12345abcd678


only numeric values should appear in the textbox

so value which should be displayed in the textbox is
12345678

Any suggesions????? Please comment

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If Asc(e.KeyChar) >= 48 And Asc(e.KeyChar) <= 57 Then
            e.Handled = False
        Else
            e.Handled = True
        End If
    End Sub

hi kimbula, if u get answer to ur question, mark this thraed as solved,so dat it will be helpfull for others also

Sorry for my delayed actions.
Thank you very much. This is working
Awesome

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.