Re: Additional information: Exception has been thrown by the target of an invocation. by Andy
Andy
Wed Aug 18 11:18:32 CDT 2004
"Pawe³ Skowron" <pskowron@mail.atr.bydgoszcz.pl> wrote in message
news:ehUYhAJhEHA.3928@TK2MSFTNGP11.phx.gbl...
> Hi,
> I have .dll with Form and ImageList component,
> when I'm making instance, I got execption:
>
> An unhandled exception of type
'System.Reflection.TargetInvocationException'
> occurred in mscorlib.dll
> Additional information: Exception has been thrown by the target of an
> invocation.
>
> at line:
> this.imglToolBar.ImageStream =
>
((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imglToolBar.I
> mageStream")));
>
> What is wrong?
>
> thx in andvance
>
> pawel
>
Those kind of errors are difficult to troubleshoot.
Put a try/catch around the code which makes the instance, and examine the
InnerException property of the TargetInvocationException. It should lead
you to a better description. My guess is that your GetObject call is
returning Null for some reason, and the cast is failing.
Best Regards,
Andy