I have a little problem with a textbox. I want it to take a price but the problem is that we can enter multiple commas which will make everything not work. I want to limit the number of commas to 1
Here is what I tried:
If ("0123456789,\b".IndexOf(e.KeyChar) = -1) Then
If e.KeyChar <> Convert.ToChar(Keys.Back) Then
If (",".IndexOf(e.KeyChar) = -1) And txtPrix.Text.Contains(",") Then
e.Handled = False
Else
e.Handled = True
End If
End If
The most reliable would be to use
Double.TryParseorDecimal.TryParse: