renu
renu

Reputation:

validations in textbox in vb.net

i have a textbox wherein the user is required to enter amount.i want to know the way to put a validation on the key press event so that the user might not enter more than one decimal point i.e user is allowed to enter values like 99.999 only not like 99...22 plz suggest some property or method to do this??

Upvotes: 1

Views: 1124

Answers (1)

Chris
Chris

Reputation: 9539

Regular expressions are a good way to do that!

Check out:

http://en.wikipedia.org/wiki/Regular_expression

http://www.regular-expressions.info/dotnet.html

This might be the regex you are looking for:

[0-9]+(\.[0-9]*)?

Upvotes: 1

Related Questions