I have a form with 4 different textboxes. Each box needs to have a certain number of characters entered in so I'm writing if/else statements. For example:
if ((dlg.nameText.Length > 5) || (dlg.nameText.Length < 8))
this.DialogResult = DialogResult.None;
MessageBox.Show("Error message goes here");
else
this.DialogResult = DialogResult.OK;
It goes on like that for all 4 textfields with one problem -- if the last field is valid we go back to the main application form and the user doesn't get a chance to fix his mistakes. I could write a fairly long if statement, so that if any one of those values is not the length I want it to be an all encompassing message is returned to the user, but that isn't very practical or elegant. At the end of all 4 if statements I want some piece of code that says, 'if any one of these if statements returned DialogResult.None then don't exit, even if the last if statement returned DialogResult.OK'
Any tips?