By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,498 Members | 1,564 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,498 IT Pros & Developers. It's quick & easy.

How to test if a control's validating or validate event has fired and is finished

P: n/a
Hi

if i derive a reference to a control on a winform
(ie Control activeControl = somecontrol on the form) how can i test
if that control has a validating or validated event and more
importantly how can i tell that those events have finished so that i
can test for a new situation.

My problem is i am modding some existing code, were the TAB key
keypress is captured by a external c# module.

this module does this

if (keypress)
get current active control

if keypress == tab
move to next control

if (current activecontrol == get current active control)
set focus to mainForm.
This last condition check is causing problems for me because i have
added validating and errorprovider events to text boxes on the form,
and when a validating error occurs the last conditional check, which
of course is checking to see if the control is now a new control,
fires and somehow changing the focus while the error provider is
active, locks me out of being able to click on anything on the form.

I dont have a choice of getting rid of that last conditional check.
So how can i get it to do the last conditional check after a tab
keypress AND after any validating and validated and errorprovider
stuff has finished

any help appreciated

thanks

Peted

Jul 14 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mon, 14 Jul 2008 00:55:32 -0700, <Petedwrote:
if i derive a reference to a control on a winform
(ie Control activeControl = somecontrol on the form) how can i test
if that control has a validating or validated event and more
importantly how can i tell that those events have finished so that i
can test for a new situation.
All controls have the event. Whether they are actually _doing_ anything
depends on the control and how it's used. There's no way for your code to
find that out though, as the event is a private field and not subject to
inspection by your own code. You can of course subscribe to the events
yourself though, and use some kind of flags to track the sequence of the
events being raised.

Whether that would actually address your issue is not at all clear though.
[...]
if (current activecontrol == get current active control)
set focus to mainForm.
This last condition check is causing problems for me because i have
added validating and errorprovider events to text boxes on the form,
and when a validating error occurs the last conditional check, which
of course is checking to see if the control is now a new control,
fires and somehow changing the focus while the error provider is
active, locks me out of being able to click on anything on the form.
[...]
This question doesn't make any sense to me. You are saying that simply
_examining_ the state of your controls is changing the state. That
shouldn't be possible given correct code.

Of course, you didn't post actual code, so it's impossible to say what's
actually happening or how to fix it. You may want to consider providinga
better level of detail in your post.

Pete
Jul 14 '08 #2

P: n/a
On Mon, 14 Jul 2008 09:20:48 -0700, "Peter Duniho"
<Np*********@nnowslpianmk.comwrote:
>
All controls have the event. Whether they are actually _doing_ anything
depends on the control and how it's used. There's no way for your code to
find that out though, as the event is a private field and not subject to
inspection by your own code. You can of course subscribe to the events
yourself though, and use some kind of flags to track the sequence of the
events being raised.

Whether that would actually address your issue is not at all clear though.
>[...]

i think you are correct it would prob be best for me to try some flag
setup to track the events bieng fired. I should have thought of that,
but i was trying to be too clever about it

thanks

Peted
Jul 18 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.