validation checking an inputbox

great_trip5

New member
Joined
Dec 1, 2006
Messages
2
Programming Experience
Beginner
I would like to check the user input into an inputbox in vb.net 2003. The inputbox in my program assigns the input from the inputbox into an array called get_grades which takes in students grades as in.. A.. B.. C...D...F. My question is how could I check the user input to make sure its within that range.. A..B...C...D...F? and if not use a messagebox to say " Please enter a letter grade from....."
 
Firstly you should make sure that the input is one character long. Then you can create a string containing the valid characters and use the String.IndexOf method to find the index of the user input. An index of -1 indicates that the value is not present, so you know the user entered an invalid value.
 
I have a string array

Thank you. I have a string array written that contains the letters... A,B,C and so on. More specifically how would I use an indexof to check for these letters entered?
 
I would like to check the user input into an inputbox in vb.net 2003. The inputbox in my program assigns the input from the inputbox into an array called get_grades which takes in students grades as in.. A.. B.. C...D...F. My question is how could I check the user input to make sure its within that range.. A..B...C...D...F? and if not use a messagebox to say " Please enter a letter grade from....."

In modern programming, we call those things COMBO BOXES :)

When a set of choices is limited to less than 20 discrete values, consider a combo box. Consider a listbox, maybe with search, if there are to be more than 20 values
 
Back
Top