Software Engineer, Equity Strategist, Polymath.
Make a Textbox that accepts only numbers
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Const pstr As String = "0123456789"
If pstr.IndexOf(e.KeyChar) = -1 Then
e.Handled = True
End If
End Sub
If you want to add “.” for exmaple to the combination you can change first line to
Const pstr As String = "0123456789"
Leave a Reply
You must be logged in to post a comment.