Quantcast
Viewing all articles
Browse latest Browse all 12583

Validating multiple textboxes

I've been searching and reading these forms for a few hours, trying to come up with a solution for this. Being very new to C#, I'm beginning to learn that you can solve a problem many different ways. It tends to be overwhelming as a student of C# :)

I have a form with 3 different TextBox. "Address" (custAddressField) "Zip" (custZipField) "State" (custStateField). 

I already have a "Save & Exit" Button, once clicked it saves to a .csv file. This code is already written.

I want to be able to Validate before saving, if it's invalid it will show an error.

This is what I want to Validate:

1. custAddressField can only contain numbers, letters, and .

2. custZipField can only contain numbers

3. custStateField can only contain letters

4. Insure that no fields are left blank.

Can this be put in all one, e.g. ValidateAllFields();? Or will I have to separate ValidateAddressField(); ValidateStateField(); ValidateZipField();..?

Thanks for any help that I receive on this.


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>