Solved

textbox Leave event

Posted on 2011-03-01
2
299 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 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

615 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