Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

textbox Leave event

Posted on 2011-03-01
2
Medium Priority
?
303 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
rawinnlnx9 earned 1000 total points
ID: 35011220
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 1000 total points
ID: 35011910
Actually, you need to set CausesValidation=false on your "cancel" button, rather than on the textbox itself.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

670 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