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

P

Peted

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
 
P

Peted

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top