Ari

Ari

  • NA
  • 8
  • 50.9k

C# error messages for incorrect input value (regex) and empty textboxes

Nov 7 2011 11:04 PM
Hey there, I have a question about Regex and error checking for empty text boxes.

I have a windows form application which has a name textbox, phone number textbox, and email textbox. They all have regex assigned, basically, when the user clicks the submit button, is there a way i can display a messagebox which gives the user info on which textbox has failed? Ie if they enter letters into the phone number text box, a message box would pop up and say something like "Please no letters, only numbers" etc etc.

Obviously I could use a general messagebox, but that seems quite unusable, as it doesn't highlight the errors ,and it might be difficult to pinpoint such errors in some circumstances.

Thanks in advance,
Ari

Answers (3)