Hello,

How can i disable the Validating Event of all the controls of a form after a
click on a Cancel Button and close the Form?

Or how can fix the order of Validating events of the controls in a Form?

Thanks in advance.

Pascal

RE: Validating events by v-yiy

v-yiy
Thu Sep 25 22:19:51 CDT 2003

Hi Pascal,
Sorry, I'm not clear about your problem. the Validating event of Control
is fired when the focus is moving off. It is not fired on form closing. If
you just want to disable the Validating events, you may try this way in
your From_Closing handler.

foreach(Control c in Controls)
c.CausesValidation = false;
Also, because Validation is fired on focus leave, there is no concept of
validation order.
If you want to validate the controls in some order when the form closing ,
you need add these
codes to the Form_Closing event.

Does this answer your problem?
If you still have problems on this issue, please be free to let me know.
Thanks!



Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
You should not reply this mail directly, "Online" should be removed before
sending, Thanks!

--------------------
| From: "Pascal Cloup" <pcloup@biogesta.fr>
| Subject: Validating events
| Date: Thu, 25 Sep 2003 09:21:30 +0200
| Lines: 12
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| Message-ID: <eoXElWzgDHA.3616@TK2MSFTNGP11.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.windowsforms
| NNTP-Posting-Host: alille-107-1-14-86.w81-48.abo.wanadoo.fr 81.48.217.86
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.windowsforms:53075
| X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
|
| Hello,
|
| How can i disable the Validating Event of all the controls of a form
after a
| click on a Cancel Button and close the Form?
|
| Or how can fix the order of Validating events of the controls in a Form?
|
| Thanks in advance.
|
| Pascal
|
|
|


Re: Validating events by Pascal

Pascal
Fri Sep 26 04:20:57 CDT 2003

Hi Ying-Shen,

this is not really an answer of my problem, but bow i understand why i can't
use the Validating Event for my purpose.
I thought of being able to use the Validating Events of each controls when
the user click on a Ok Button (to close the form) and disabling these events
if the user click on a Cancel Button; but it is not possible to reset the
CauseValidation property of each controls just after a click on a
CancelButton (and before the validating event of the control that had the
focus).

So i implement my own validating method that i called when i want.

Best regards,

Pascal


"Ying-Shen Yu[MSFT]" <v-yiy@online.microsoft.com> a écrit dans le message de
news: 7gPg#z9gDHA.456@cpmsftngxa06.phx.gbl...
> Hi Pascal,
> Sorry, I'm not clear about your problem. the Validating event of Control
> is fired when the focus is moving off. It is not fired on form closing. If
> you just want to disable the Validating events, you may try this way in
> your From_Closing handler.
>
> foreach(Control c in Controls)
> c.CausesValidation = false;
> Also, because Validation is fired on focus leave, there is no concept of
> validation order.
> If you want to validate the controls in some order when the form closing ,
> you need add these
> codes to the Form_Closing event.
>
> Does this answer your problem?
> If you still have problems on this issue, please be free to let me know.
> Thanks!
>
>
>
> Best regards,
>
> Ying-Shen Yu [MSFT]
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
>
> This posting is provided "AS IS" with no warranties and confers no rights.
> You should not reply this mail directly, "Online" should be removed before
> sending, Thanks!
>
> --------------------
> | From: "Pascal Cloup" <pcloup@biogesta.fr>
> | Subject: Validating events
> | Date: Thu, 25 Sep 2003 09:21:30 +0200
> | Lines: 12
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
> | Message-ID: <eoXElWzgDHA.3616@TK2MSFTNGP11.phx.gbl>
> | Newsgroups: microsoft.public.dotnet.framework.windowsforms
> | NNTP-Posting-Host: alille-107-1-14-86.w81-48.abo.wanadoo.fr 81.48.217.86
> | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
> | Xref: cpmsftngxa06.phx.gbl
> microsoft.public.dotnet.framework.windowsforms:53075
> | X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
> |
> | Hello,
> |
> | How can i disable the Validating Event of all the controls of a form
> after a
> | click on a Cancel Button and close the Form?
> |
> | Or how can fix the order of Validating events of the controls in a Form?
> |
> | Thanks in advance.
> |
> | Pascal
> |
> |
> |
>



Re: Validating events by Martin

Martin
Sat Sep 27 09:47:23 CDT 2003

Try setting the CausesValidation property on the cancel button to false.
This should prevent the Control.Validating event from being fired in the
first place.

"Pascal Cloup" <pcloup@biogesta.fr> wrote in message
news:exeIo%23AhDHA.1800@TK2MSFTNGP09.phx.gbl...
> Hi Ying-Shen,
>
> this is not really an answer of my problem, but bow i understand why i
can't
> use the Validating Event for my purpose.
> I thought of being able to use the Validating Events of each controls when
> the user click on a Ok Button (to close the form) and disabling these
events
> if the user click on a Cancel Button; but it is not possible to reset the
> CauseValidation property of each controls just after a click on a
> CancelButton (and before the validating event of the control that had the
> focus).
>
> So i implement my own validating method that i called when i want.
>
> Best regards,
>
> Pascal
>
>
> "Ying-Shen Yu[MSFT]" <v-yiy@online.microsoft.com> a écrit dans le message
de
> news: 7gPg#z9gDHA.456@cpmsftngxa06.phx.gbl...
> > Hi Pascal,
> > Sorry, I'm not clear about your problem. the Validating event of
Control
> > is fired when the focus is moving off. It is not fired on form closing.
If
> > you just want to disable the Validating events, you may try this way in
> > your From_Closing handler.
> >
> > foreach(Control c in Controls)
> > c.CausesValidation = false;
> > Also, because Validation is fired on focus leave, there is no concept
of
> > validation order.
> > If you want to validate the controls in some order when the form closing
,
> > you need add these
> > codes to the Form_Closing event.
> >
> > Does this answer your problem?
> > If you still have problems on this issue, please be free to let me know.
> > Thanks!
> >
> >
> >
> > Best regards,
> >
> > Ying-Shen Yu [MSFT]
> > Microsoft Online Partner Support
> > Get Secure! - www.microsoft.com/security
> >
> > This posting is provided "AS IS" with no warranties and confers no
rights.
> > You should not reply this mail directly, "Online" should be removed
before
> > sending, Thanks!
> >
> > --------------------
> > | From: "Pascal Cloup" <pcloup@biogesta.fr>
> > | Subject: Validating events
> > | Date: Thu, 25 Sep 2003 09:21:30 +0200
> > | Lines: 12
> > | X-Priority: 3
> > | X-MSMail-Priority: Normal
> > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
> > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
> > | Message-ID: <eoXElWzgDHA.3616@TK2MSFTNGP11.phx.gbl>
> > | Newsgroups: microsoft.public.dotnet.framework.windowsforms
> > | NNTP-Posting-Host: alille-107-1-14-86.w81-48.abo.wanadoo.fr
81.48.217.86
> > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
> > | Xref: cpmsftngxa06.phx.gbl
> > microsoft.public.dotnet.framework.windowsforms:53075
> > | X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms
> > |
> > | Hello,
> > |
> > | How can i disable the Validating Event of all the controls of a form
> > after a
> > | click on a Cancel Button and close the Form?
> > |
> > | Or how can fix the order of Validating events of the controls in a
Form?
> > |
> > | Thanks in advance.
> > |
> > | Pascal
> > |
> > |
> > |
> >
>
>