Bizarre error with Invoke()

  • Thread starter Thread starter Luk Vloemans
  • Start date Start date
L

Luk Vloemans

Hey,

I'm writing software for the Compact .NET framework.

I'm trying to use the Invoke() function, wich takes one paramater: a
delegate function.

The program compiles, but on execution throws an exception.
(ArgumentException)

According to MSDN, this exception means that the 2nd parameter of the
Invoke() function isn't compatible with the delegate function.

However, there doesn't exist an Invoke() function with 2 parameters in
the .NET compact framework. (only in the .NET framework)

I'm sure it's propably something I overlooked..
Anybody got a clue ?


Thx a lot!

Luk Vloemans
IT student
 
Declare your Invoke target as
void fnTarget(object sender, EventArgs args)

call it like this:
Form1.Invoke.(new EventHandler(fnTarget));
 
This is an MSDN documentation issue that we are trying to get fixed.

The desktop version of Invoke which accepts only a single delegate
parameter can accept EventHandler delegates, MethodInvoker delegates, or
any delegate that takes no arguments.

However, the CF version can only accept EventHandler delegates..

Jeremy Hance
NET Compact Framework

This posting is provided "As Is" with no warranties, and confers no rights.
 
Back
Top