Bizarre error with Invoke()

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
 
A

Alex Feinman [MVP]

Declare your Invoke target as
void fnTarget(object sender, EventArgs args)

call it like this:
Form1.Invoke.(new EventHandler(fnTarget));
 
J

Jeremy Hance [MSFT]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top