Gotch@ wrote:
Quote:
I'm not sure to understand you at all.... Well I know it cannot cast
to an array of objects... but in a case (the second one) it works
fine, in the first it doesn't really work, even if the code is very
similar. I'm pasting the function pointed by the form delegate:
>
private void updateMyForm(Object []args)
There's your problem right there. And it's just what Marc said it was.
The delegate method updateMyForm (that is, the method assigned to the
delegate variable) takes an object[] parameter ("args"), but you are
passing it a UiMsg instance.
And again, to fix it you need to do just as Marc suggested. Instead of:
Invoke(FormCall, new Object[]{ o });
You need:
Invoke(FormCall, new Object[]{ new object[] { o } })
Actually, there's no need for the "o" variable, since "ums" is already
an object instance (everything inherits object). So you really could
just write:
Invoke(FormCall, new Object[]{ new object[] { ums } });
While I don't recommend creating forms from more than one thread, it's
not necessarily a problem and for sure it has nothing to do with this
issue. This is a straight-forward issue of you failing to provide the
correct type for the parameter to the method.
As for the difference from the second example you posted, well...since
you didn't post complete code, it's difficult to say for sure. But it's
pretty obvious that if it works, you are passing the correct type for
the parameter and so obviously the delegate method being called is not
exactly the same or the way in which you are calling it is not exactly
the same.
Pete