In my program following line:
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
is giving System.Reflection.TargetInvocationException was unhandled by user code Message "Exception has been thrown by the target of an invocation."Source="mscorlib"
Note: It is thrown only when I am out of memory, otherwise it is ok.
What is the solution?
some borns good, others make good
Thursday, November 13, 2008 7:01 AM
- Edited by cissharp Thursday, November 13, 2008 8:49 AM Information added
OK, this might not sound helpful - but if it only happens when you are low on memory... use less memory?You could try looking at the .InnerException, or GetBaseException() - however, I don't expect they'll be very interesting (it might just be wrapping an OutOfMemoryException, for example).
Marc [C# MVP]Thursday, November 13, 2008 11:54 AM
Using Images in applications can be a bit tricky. Make sure you're disposing them all after using them. They tend to stick in memory a little longer than needed, and when you load alot of them, you can get a plain ol' vanilla out of memory exception.
David Morton - http://blog.davemorton.net/Thursday, November 13, 2008 3:46 PMModerator