how to suppress an event?

G

Guest

Is there any way to suppress an event method?

i got Enter & leave Events on two groupBoxs, they r " private void groupBox1_Enter(object sender, System.EventArgs e)" and private void groupBox1_Leave(object sender, System.EventArgs e) event methods, from msdn info the order of execution for them will be
1> Enter
2>GotFocus
3>lost focus
4>Leave
5>Validating

i used only Enter and Leave events, after entering a groupBox i can see that "Enter" event has been fired but when i fire a gui event with my mouse click, Leave event is not getting activated. so i manually activating that event method, but in some situations its getting activated too many time.
if the above info is too confusing just answer this Question "can i cancel an event before its getting activated?".
 
S

Stoitcho Goutsev \(100\) [C# MVP]

Hi seash,

I think you run into one of the well known bugs in the framework. The
sequence of events you provided is what it has to be. Due to a bug in the
framework it happens only if the focus is switched using the *Tab* key.

To answer your question I would say there is no way to stop a control to
raise an event. If it is control written by yourself or control that you
inherit from any of the windows forms controls you can override event's
corresponding OnXXXX method and if you don't want the event to be fired
don't call the base implementation (base.OnXXXX). I don't think it solves
your problem, though.

--
B\rgds
100

seash said:
Is there any way to suppress an event method?

i got Enter & leave Events on two groupBoxs, they r " private void
groupBox1_Enter(object sender, System.EventArgs e)" and private void
groupBox1_Leave(object sender, System.EventArgs e) event methods, from
msdn info the order of execution for them will be
1> Enter
2>GotFocus
3>lost focus
4>Leave
5>Validating

i used only Enter and Leave events, after entering a groupBox i can see
that "Enter" event has been fired but when i fire a gui event with my mouse
click, Leave event is not getting activated. so i manually activating that
event method, but in some situations its getting activated too many time.
if the above info is too confusing just answer this Question "can i
cancel an event before its getting activated?".
 

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