Validating a textbox...
Posted on 2009-05-08
I am a little confused about how to use CausesValidation in a WinForms application....here is what I want to accomplish:
The user is presented with a default value in a text box, but he/she can change it to anything except a blank or a value that has already been used. (I have a function that will check that.)
If the user attempts an invalid entry, a message box explaining the problem pops up, then after the user dismisses the message box, the value in the text box reverts to whatever it was before the user edited it.
How would I use CausesValidation and the Validation and/or Focus events to accomplish the above? I've been trying for hours now, but I think I may have coded myself into a corner....
Thanks in advance for your kind assistance.