your code is great and will work but as a reminder that there are always plenty of way to do something :) , this could be easily amended to allow letters only although would require extra code to avoid special character
this code also avoids clearing the textbox when invalid characters are entered -
that is the fun thing of programming trying to work out how to achieve a goal and although I just use whatever works for me several months down the line I inevitably find another way to do it
-
-
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
-
-
If Not IsNumeric(e.KeyChar) Then
-
e.KeyChar = Nothing
-
End If
-
-
End Sub
-
-