ImageList won't load, throws exception

C

Chuck

When ever I try to implement an ImageList, I always get an exception when
the application runs. The ImageList doesn't even have to be used by
anything. An empty ImageList doesn't throw!

The following exception is thrown by the following code.

*****
'System.Reflection.TargetInvocationException' occurred in mscorlib.dll

Additional information: Exception has been thrown by the target of an
invocation.
*****



---code----
....
private System.Windows.Forms.ImageList ilMainFrame;
....

private void InitializeComponent()
{
....
this.ilMainFrame.ImageStream =
((System.Windows.Forms.ImageListStreamer)(resources.GetObject
"ilMainFrame.ImageStream")));
....
}
....

The resource file the line for the iMainFrame.ImageStream looks like:

name value comment type
mimetype
ilMainFrame.ImageStream (null) (null)
application/x-microsoft.net.object.binary.base64

The mime coded image is in the .resx file. The element looks like:

<data name="ilMainFrame.ImageStream"
mimetype="application/x-microsoft.net.object.binary.base64">
<value>
.....
</value>
</data>

I am running VS 2003 on windows XP pro.

I have looked through MSDN, but no help.


If anyone has an answer please tell me, before I have to phone Microsoft
($$$$).


Chuck
 
D

Daniel O'Connell

Could you provide more information about the exception, like the stack trace
and any subexceptions?
 
C

Chuck

No usable stack trace as the problem is occuring in InitializeComponent()
called by class constructor. No inside info available.

As there isn't a whole lot of complaining going on, I expect a configuration
problem somewhere.
 
D

Daniel O'Connell

Hrmm, being able to see where the failure is occuring within image list may
be of value, stricty based on a reflection exception I'm afraid there isn't
much I can do to help.
 
J

Jax

I got this a while ago, my problem was due to the fact i'd
put one of my classes in a folder but then removed the
folder prefix from it's namespace.
I'd assume it was a problem with the file which the image
list is in, rather then the image list itself.
Try loading other graphics with it to see if thats the
case.
I find that most of those kind of problems can be solved
by just moving things around in your project (don't ask me
how or why, it just does sometimes).

Hope thats vaguely useful
jax
 

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