You will have to check if the value they input is valid in either one of the Key events, or in one of the Validation events. If you are using the 2.0 framework this can be done using the double.TryParse() method. If you are using the 1.0/1.1 framework you will have to use double.Parse() and catch the exception.
Alternatively if you change one of the key events of the textbox you can allow only the number keys.
The double data type also supports TryParse in .Net 1.x. The difference is that in 1.x, double is the only data type that supports TryParse, whereas in .Net 2.0, most native types support it.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.