Index Of(".") This should restrict user input to decimal values, allowing negative values as well.
I am trying to set up a form to accept a telephone number, but i am unsure of how to validate it so it will only take numeric values with 11 digits. Show("You must enter a Telephone Number.", "Data Entry Error", Message Box Buttons. Information) 'makes sure that only numbers and the backspace are allowed in the fields.
I am trying to validate wether a number is a decimal in Visual Basic. Therefore you can use the solutions that others have mentioned and use any of the following in a sensible way.
The results I get when the number is valid the msg Box shows. Private Sub txt Value_Key Press(By Val sender As Object, By Val e As System.
Originally it was just going to be 3 or 4 options but it just kept going.
2) I will, in the future add exceptions for copy and paste etc.
This solution is not complete however as it would allow a user to enter just "-" in the text box which would (presumably) not be a valid input for you.