Textbox Validation

noosaj

Member
Joined
Mar 5, 2007
Messages
6
Programming Experience
Beginner
Hello!

I am new to these forums as well as VB.NET. I use VS.NET 2005 and primarily use Visual Basic. I'm a college student studying programming.

I am creating a very simple sales tax calculator. I've run into an issue. There are three textboxes, all for user input: one for dollar amount, one for sales tax, and the other one is the total. How do I make sure the user enters only numbers? I've already written code (If...Else) to make sure the user doesn't leave the textboxes blank before clicking on the Compute button. Someone mentioned using validation, but I'm not quite sure what this means.

I hope you understand what I'm trying to explain. Please bear with me as I am learning.

Thanks!

Jason
 
You can use the MaskedTextBox control and set it's format for numeric input with the Mask property.

Also look into Validating and Validated events in documentation. And the ErrorProvider component.
 
JohnH,

Ahh, yes, thank you. I see that control. I will definitely try it and see if it works. Again, thanks for your help. I appreciate it.

Jason
 
Back
Top