this.InvokeRequired and EventArgs

  • Thread starter Thread starter davis
  • Start date Start date
D

davis

Hi, I'm developing a PocketPc app in c# with .NET 2.0. I have a socket
server thread in a dll that issues and EventHandler to the client
program which is the windows form.

I know this topic has been covered before, but I still haven't quite
found my answer. I read this nice in-depth coverage of the topic:

http://weblogs.asp.net/justin_rogers/articles/126345.aspx

His solution using EventHandlers works to solve my InvokeRequired
exception, but the problem is that I actually need the EventArgs that
is passed in, b/c it has data I want.

Is there are variation on the solution described in his page that
allows me to get at the EventArgs?

Thx in advance,
Davis
 
davis said:
Hi, I'm developing a PocketPc app in c# with .NET 2.0. I have a socket
server thread in a dll that issues and EventHandler to the client
program which is the windows form.

I know this topic has been covered before, but I still haven't quite
found my answer. I read this nice in-depth coverage of the topic:

http://weblogs.asp.net/justin_rogers/articles/126345.aspx

His solution using EventHandlers works to solve my InvokeRequired
exception, but the problem is that I actually need the EventArgs that
is passed in, b/c it has data I want.

Is there are variation on the solution described in his page that
allows me to get at the EventArgs?

Thx in advance,
Davis

Solved my own problem :)

if (this.InvokeRequired) {
// we were called from a different thread
this.Invoke(new MyDataHandler(DataEventHandler), new
object[] { sender, e });
return;
} else {
// do something with data
}
 
Back
Top