473,386 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Cancel a validation event based on what comes next

I normally validate the data in a control in that controls validating event.
I also normally have a Cancel button on each form which does a RejectChanges
to reset any unsaved data on the form. Clearly, if the user puts invalid
data into a control and then hits the Cancel button there is no need to do
the validation since the data will all be reset anyway. My question is how
do I determine what was clicked that caused the original control to lose
focus and thereby kick off it's validating event.
Within the validating event I would want to determine if the user just
clicked the Cancel button and, if so, just exit the validating routine.
Is there a way this can be done? As of now, the user is forced to go back
to the control and put in 'good' data before he is allowed to 'cancel' and
that makes no sense at all.

John
Mar 24 '06 #1
1 1183
About 15 min after I posted I found the answer. Simply set the
"CausesValidation" property of the Cancel button to false.

"JohnR" <Jo******@hotmail.com> wrote in message
news:31KUf.1499$Qm2.75@trndny03...
I normally validate the data in a control in that controls validating
event. I also normally have a Cancel button on each form which does a
RejectChanges to reset any unsaved data on the form. Clearly, if the user
puts invalid data into a control and then hits the Cancel button there is
no need to do the validation since the data will all be reset anyway. My
question is how do I determine what was clicked that caused the original
control to lose focus and thereby kick off it's validating event.
Within the validating event I would want to determine if the user just
clicked the Cancel button and, if so, just exit the validating routine.
Is there a way this can be done? As of now, the user is forced to go back
to the control and put in 'good' data before he is allowed to 'cancel' and
that makes no sense at all.

John

Mar 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Arno R | last post by:
Hi all I come across a 'feature' of Access (2000) that I don't like and would like to disable. I am checking if a value already exists in a table. I a subform I use code like : Private Sub...
6
by: downwitch | last post by:
OK, the last time didn't get an answer, let's see if I can explain it better. (Someone else here _must_ have done this at some point?) I have a progress-meter type thing set up to follow the...
0
by: PeacError | last post by:
Using Microsoft Visual Studio .NET 2003, Visual C# .NET 1.1: I apologize if this question has been addressed elsewhere, but I could not find a reference to it in the search engine for this...
9
by: AFN | last post by:
I was just dropped into someone else's code (isn't that always so fun?). I can't figure out why a custom validation control's server event function is executing. There is nothing (that I see)...
6
by: Peter M. | last post by:
Hi all, If an event has multiple subscribers, is it possible to cancel the invocation of event handlers from an event handler? Or to be more specific: I'm subscribing to the ColumnChanging...
1
by: David Veeneman | last post by:
I am writing a control that relies on its host to validate the contents of one of its fields. The control fires a custom 'FooNeedsValidating' event and passes the field's data with the event. The...
21
by: Darin | last post by:
I have a form w/ a textbox and Cancel button on it. I have a routine to handle textbox.validating, and I have the form setup so the Cancel button is the Cancel button. WHen the user clicks on...
1
by: Frank O'Hara | last post by:
I think I'm losing my mind, granted it is kind of late here so... I'm trying to do some simple validation on the client as keys are pressed. The validation routine works well enough however I...
5
by: Steve | last post by:
In VB6 I have a screen the has a text box and a datagrid If I click the datagrid, the 1st event is to validate the textbox and then the 2nd event is a datagrid mousedown event. If a get an error...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.