User input in textboxes

N

noosaj

Hi,

I'm designing a basic sales tax calculator. I'm in a bind here. I am
trying to figure out how to prevent the user from inputting anything
other than numbers in the textboxes.

Obviously, only numbers can be used to calculate sales tax based on a
dollar amount the user inputs. Suppose the user inputs characters
other than numbers, such as punctuation or letters; how do I prevent
that? I would like to present a messagebox warning the user that he
or she has entered something other than numbers. How do I go about
doing this?

Thanks,

noosaj
 
T

tomb

noosaj said:
Hi,

I'm designing a basic sales tax calculator. I'm in a bind here. I am
trying to figure out how to prevent the user from inputting anything
other than numbers in the textboxes.

Obviously, only numbers can be used to calculate sales tax based on a
dollar amount the user inputs. Suppose the user inputs characters
other than numbers, such as punctuation or letters; how do I prevent
that? I would like to present a messagebox warning the user that he
or she has entered something other than numbers. How do I go about
doing this?
In the validating event

T
 
C

Cor Ligthert [MVP]

Noosaj,

Have a look at the masked textbox which is in VS starting at version 2005

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top