I have an issue, The thing is I have to allow user to enter numeric value in text box up to one decimal point,
When all text selected and I try try to edit text by entering any numeric key, It wont let it change.
Here is the text box with value.
The code behind, Keypress
Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Regex.IsMatch(TextBox1.Text, "\.\d") Then
e.Handled = True
End If
End Sub
Kindly anybody help or suggest better way.
I have added this code but I am unable to restrict user not to enter more then one decimal point value.
If Not ((Asc(e.KeyChar) >= 48 And Asc(e.KeyChar) <= 57) Or Asc(e.KeyChar) = 46 Or Asc(e.KeyChar) = 8 Or Asc(e.KeyChar) = 127) Then
e.KeyChar = ""
e.Handled = False
End If