Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2004

Tip: Looking for answers? Try searching our database.

Validating a text box and a cancel button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Dunaway - 14 Sep 2004 16:08 GMT
I have a form with a textbox on it.  The textbox will contain a user
entered id number.  Since I want the ID number to be unique, I have added a
validating event handler to check that the user id entered is not already
in the collection.  If it is, I indicate an error to the user and set the
cancel property of the validating event to True so the user will enter the
id again.

I also have a cancel button on the form.  If the user has entered an
incorrect value in the textbox and then clicks cancel, I don't care about
the validation.  

But, when the user clicks the button, it still indicates that the entered
user ID is invalid.  I want, that if they click cancel, to ignore the
validation of the textbox.  To do this, I set the CausesValidation propert
of the *cancel button* to false, thinking that when clicked the form would
not be validated, but it has not worked.

Any suggestions?

Signature

Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.

Chris Dunaway - 14 Sep 2004 16:58 GMT
Solved my own problem.  The Cancel button was on a panel whereas the
textbox was not.  It was the panel that was causing the validation.  I set
the panel's CausesValidation property to false and that solved the problem.

Thanks

Signature

Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.