Imagelist (error when loading the imagestream during the InitializeComponent)

I've got a weird problem that I'm experiencing with VS2003 installed with VS2005. (The error does not occur in a machine that has VS2003 only)

I have an imagelist on a form and I I can't run the program because it'll throw an exception while loading the imagestream during the InitializeComponent call.

this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));

The line that sets the ImageStream is the one that throws the exception:

"An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Additional information: Exception has been thrown by the target of an invocation."

I looked at the .resx file for the form and the data is there.

Anyone have any ideas


Thanks,

Jorge




Answer this question

Imagelist (error when loading the imagestream during the InitializeComponent)

  • goofaholix

    Could you provide more detail from the exception TargetInvocationException is pretty vague.

  • Rapper

    The easy solution for now that I got it, is to delete the .resx and create a new form. Copy and paste the old code to the new form, save and compile. It works.


  • Imagelist (error when loading the imagestream during the InitializeComponent)