Thread: Code validation
View Single Post
  #2 (permalink)  
Old January 4th, 2012, 03:49 PM
Maineac54 Maineac54 is offline
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jan 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Code Validation

Hi Isabella,

You need to think about how you are going to get the data to be valiated into your program. Will it be manually input?, read from a file? or a database? Or it could be hard coded into the program.

It sounds like you created a new project from the Windows Form Application template. This will give you more than you need, but it also provide a way that you could add user input to the form to get your data.

The simpliest thing to do might be to add a button to your form. Double clicking the button in the design view will create a function to respond to a click of the button when running. You can put your validation code in this function.

From your description it sounds like you will be getting a series of strings. So you might be putting the data in an array as in

string[] MyData = new string[4];

MyData[0] = "1 2 3 4 5 6 7";
or a collection such as an ArrayList:

ArrayList MyData = new ArrayList();

MyData.Add("1 2 3 4 5 6 7");

Your code will need to parse each of the strings into individual digits.
You can take advantage of member functions of the string class like "Split" to do this.

You haven't specified what about the data to validate so I'll leave that up to you.

Hopefully, I've give you enough to get started. Come back with more questions when you have more done.
Reply With Quote