Event preemption

0 views
Skip to first unread message

James

unread,
Jan 17, 2005, 5:47:20 AM1/17/05
to
Hi all,

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?

Thanks very much,
James

Jon Skeet [C# MVP]

unread,
Jan 17, 2005, 2:44:04 PM1/17/05
to
James <notmya...@mailinator.com> wrote:
> 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:

Rather than similar code, could you post a short but complete program
which demonstrates the problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk...@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

James

unread,
Jan 18, 2005, 6:45:05 AM1/18/05
to
Hi Jon,

Thanks very much for your reply.

I have figured out the problem myself now. It turns out it is a bug in
the third party control I am using. I am making the vendor aware of the
problem now.
Nice posting guidelines by the way ;-)

Regards,
James Fitzsimons

Reply all
Reply to author
Forward
0 new messages