Link to home
Start Free TrialLog in
Avatar of codefinger
codefingerFlag for United States of America

asked on

Validating a textbox...

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.



Avatar of JackOfPH
JackOfPH
Flag of Philippines image

Can you show us your code?
ASKER CERTIFIED SOLUTION
Avatar of JackOfPH
JackOfPH
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Do you need further assistance?
Avatar of codefinger

ASKER

Thanks.  I did not even suspect that the text box has an UNDO function.