Events In Form Thread

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to execute an events delegates in the windows forms thread. What is the easiest way to do this?

I created another delegate and called BeginInvoke on the active form and inside this delgate handler I invoked the events delgates. Is there an easier way?

Thanks in advance,
James
 
<=?Utf-8?B?SmFtZXMgTGVubm9u?= <James
I want to execute an events delegates in the windows forms thread.
What is the easiest way to do this?

I created another delegate and called BeginInvoke on the active form
and inside this delgate handler I invoked the events delgates. Is
there an easier way?

I think that's basically the easiest way - it's not terribly arduous,
to be honest. In my view you should be declaring the delegate and
specifying the add/remove code for the event normally anyway, otherwise
there's a hidden lock on "this". See
http://www.pobox.com/~skeet/csharp/multithreading.html#lock.choice
 
Back
Top