Solved

textbox Leave event

Posted on 2011-03-01
2
273 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
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 250 total points
ID: 35011910
Actually, you need to set CausesValidation=false on your "cancel" button, rather than on the textbox itself.
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

773 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