Event preemption?

So I’ve been having this wierd problem with event execution order where half way through handling one event another event handler is fired. If you know why please enlighten me!

Here’s a copy of my newsgroup post which you can find here.

I am seeing some unexpected behaviour in a single threaded winforms app

and was hoping someone could explain what is going on.

I have two events attached to a chart control on my form, and during

execution one event seems to preempt the execution of the other.

My code looks similar to the following:

private void MyChart_Click(object sender, System.EventArgs e)

{

…do some logic tests

GetSomeData();

}

// This event is attached to the context menu for the chart control.

private void DrillDownMenuItem_Click(object sender, System.EventArgs e)

{

…do stuff

}

private DataSet GetSomeData()

{

…setup tasks

…Call web service

…finish stuff

}

What happens is that when I right click and select drill down from the

chart controls context menu the MyChart_Click event fires and does the

logic tests. Execution then steps into the GetSomeData method, but when

the web service is called execution jumps to the

DrillDownMenuItem_Click event. This runs to completion then execution

returns to the GetSomeData method which finishes and finally returns to

the MyChart_Click event handler.

Can someone explain why this is so?

[EDIT] so I figured it out by myself. I turns out it is a bug in the dundas chart control >:-(

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s