I am using Visual Basic Express 2008.
I have added the following code to my text box:
Private Sub TextBox1_KeyPre ss(ByVal sender As Object, ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles TextBox1.KeyPre ss
If Not IsNumeric(e.Key Char) Then
MessageBox.Show ("Please insert numbers only.", "Error!", MessageBoxButto ns.OK, MessageBoxIcon. Exclamation)
e.KeyChar = Nothing
End If
End Sub
The problem is that if I click Backspace it shows the same error and I can't change a type error. Is there a way to get it working?
I have added the following code to my text box:
Private Sub TextBox1_KeyPre ss(ByVal sender As Object, ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles TextBox1.KeyPre ss
If Not IsNumeric(e.Key Char) Then
MessageBox.Show ("Please insert numbers only.", "Error!", MessageBoxButto ns.OK, MessageBoxIcon. Exclamation)
e.KeyChar = Nothing
End If
End Sub
The problem is that if I click Backspace it shows the same error and I can't change a type error. Is there a way to get it working?
Comment