Original Post
Ok, in my program, the user needs to enter their user number before continuing on. If they don't enter a valid integer, the program throws an exception. Instead of continuing on, I want the program to wait for the user to try inputting a valid number, then start the try block over again. Here's the code.
int number = 0;
try {
number = Convert.ToInt32(usernumber.Text);
usernumber.Text = "";
}
catch {
MessageBox.Show("You didn't enter a number. Please double-check your input and try again.");
usernumber.Text = "";
}
user = new User(number);
trial = new Trial(number);
InitializeForms();
StartTrials();