Solved

textbox Leave event

Posted on 2011-03-01
2
253 Views
Last Modified: 2012-05-11
I have validation in the leave event of a textbox.  one thing that I notice happening is when I click a button to cancel out of the form and the validation isn't correct it won't let me dispose of the form.  The validation stops it.  Really the validation is doing exactly what I want it to but I need to be able to hit the button and basically have that override the validation.  Is there a way to do that in the Leave event?
0
Comment
Question by:oak29
2 Comments
 
LVL 9

Accepted Solution

by:
rawinnlnx9 earned 250 total points
Comment Utility
Try changing this in your leave event:

textBox.CausesValidation = False;

Alternatively you could also set some flag bool EnableValidation=true; and then set it to false then have your validation events check that value before proceeding.
0
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 250 total points
Comment Utility
Actually, you need to set CausesValidation=false on your "cancel" button, rather than on the textbox itself.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now