473,854 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ImageList won't load, throws exception

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.Reflect ion.TargetInvoc ationException' 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 InitializeCompo nent()
{
....
this.ilMainFram e.ImageStream =
((System.Window s.Forms.ImageLi stStreamer)(res ources.GetObjec t
"ilMainFrame.Im ageStream")));
....
}
....

The resource file the line for the iMainFrame.Imag eStream looks like:

name value comment type
mimetype
ilMainFrame.Ima geStream (null) (null)
application/x-microsoft.net.o bject.binary.ba se64

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

<data name="ilMainFra me.ImageStream"
mimetype="appli cation/x-microsoft.net.o bject.binary.ba se64">
<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
Nov 15 '05 #1
4 4879
Could you provide more information about the exception, like the stack trace
and any subexceptions?
"Chuck" <ce*****@austin .rr.com> wrote in message
news:t0******** ***********@twi ster.austin.rr. com...
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.Reflect ion.TargetInvoc ationException' 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 InitializeCompo nent()
{
...
this.ilMainFram e.ImageStream =
((System.Window s.Forms.ImageLi stStreamer)(res ources.GetObjec t
"ilMainFrame.Im ageStream")));
...
}
...

The resource file the line for the iMainFrame.Imag eStream looks like:

name value comment type mimetype
ilMainFrame.Ima geStream (null) (null)
application/x-microsoft.net.o bject.binary.ba se64

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

<data name="ilMainFra me.ImageStream"
mimetype="appli cation/x-microsoft.net.o bject.binary.ba se64">
<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

Nov 15 '05 #2
No usable stack trace as the problem is occuring in InitializeCompo nent()
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.

"Daniel O'Connell" <onyxkirx@--NOSPAM--comcast.net> wrote in message
news:u5******** ******@TK2MSFTN GP12.phx.gbl...
Could you provide more information about the exception, like the stack trace and any subexceptions?
"Chuck" <ce*****@austin .rr.com> wrote in message
news:t0******** ***********@twi ster.austin.rr. com...
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.Reflect ion.TargetInvoc ationException' 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 InitializeCompo nent()
{
...
this.ilMainFram e.ImageStream =
((System.Window s.Forms.ImageLi stStreamer)(res ources.GetObjec t
"ilMainFrame.Im ageStream")));
...
}
...

The resource file the line for the iMainFrame.Imag eStream looks like:

name value comment

type
mimetype
ilMainFrame.Ima geStream (null) (null) application/x-microsoft.net.o bject.binary.ba se64

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

<data name="ilMainFra me.ImageStream"
mimetype="appli cation/x-microsoft.net.o bject.binary.ba se64">
<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


Nov 15 '05 #3
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.
"Chuck" <ce*****@austin .rr.com> wrote in message
news:jE******** *************@t wister.austin.r r.com...
No usable stack trace as the problem is occuring in InitializeCompo nent()
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.

"Daniel O'Connell" <onyxkirx@--NOSPAM--comcast.net> wrote in message
news:u5******** ******@TK2MSFTN GP12.phx.gbl...
Could you provide more information about the exception, like the stack

trace
and any subexceptions?
"Chuck" <ce*****@austin .rr.com> wrote in message
news:t0******** ***********@twi ster.austin.rr. com...
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.Reflect ion.TargetInvoc ationException' 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 InitializeCompo nent()
{
...
this.ilMainFram e.ImageStream =
((System.Window s.Forms.ImageLi stStreamer)(res ources.GetObjec t
"ilMainFrame.Im ageStream")));
...
}
...

The resource file the line for the iMainFrame.Imag eStream looks like:

name value comment

type
mimetype
ilMainFrame.Ima geStream (null) (null) application/x-microsoft.net.o bject.binary.ba se64

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

<data name="ilMainFra me.ImageStream"
mimetype="appli cation/x-microsoft.net.o bject.binary.ba se64">
<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



Nov 15 '05 #4
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
-----Original Message-----
Hrmm, being able to see where the failure is occuring within image list maybe of value, stricty based on a reflection exception I'm afraid there isn'tmuch I can do to help.
"Chuck" <ce*****@austin .rr.com> wrote in message
news:jE******* **************@ twister.austin. rr.com...
No usable stack trace as the problem is occuring in InitializeCompo nent()
called by class constructor. No inside info available.

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

"Daniel O'Connell" <onyxkirx@--NOSPAM--comcast.net>
wrote in message news:u5******** ******@TK2MSFTN GP12.phx.gbl...
> Could you provide more information about the exception, like the stack
trace
> and any subexceptions?
> "Chuck" <ce*****@austin .rr.com> wrote in message
> news:t0******** ***********@twi ster.austin.rr. com...
> > 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.Reflect ion.TargetInvoc ationException' 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 InitializeCompo nent()
> > {
> > ...
> > this.ilMainFram e.ImageStream =
> > ((System.Window s.Forms.ImageLi stStreamer) (resources.GetO bject > > "ilMainFrame.Im ageStream")));
> > ...
> > }
> > ...
> >
> > The resource file the line for the iMainFrame.Imag eStream looks like: > >
> > name value comment > type
> > mimetype
> > ilMainFrame.Ima geStream (null) (null)
> > application/x-microsoft.net.o bject.binary.ba se64
> >
> > The mime coded image is in the .resx file. The

element looks like: > >
> > <data name="ilMainFra me.ImageStream"
> > mimetype="appli cation/x- microsoft.net.o bject.binary.ba se64"> > > <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 phoneMicrosoft > > ($$$$).
> >
> >
> > Chuck
> >
> >
>
>


.

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
49033
by: Ed Sutton | last post by:
I have been searching for how to get an icon resource and load it into an ImageList. I added an *.ico file to my project and set the files "Build Action" to "Embedded Resource". Is there any easy way to do this? This was easy to do in the old MFC. I can not find the answer in C#. I also need to embed an XML file into the resource and load it at run time. I am hoping once I figure out how to load an icon resource then loading an XML...
2
13203
by: Ed Sutton | last post by:
What's the trick to loading an icon from the embedded resources? Here are the steps I have taken: ------------------------- 1 - I added a file named "FOLDER01.ICO" to my solution project 2 - I changed "Build Action" for the file to "Embedded Resource" 3 - At the end of my constructor, I try to load an icon and it throws the following exception: Exception:
1
2406
by: JaguarX | last post by:
Hi, I made an application that displays a ListView that uses an Imagelist. I load the ImageList Control from a database I have no problems when the images are Icons or JPGs (including big sized JPGs). I come to troubles when I try to add a Bitmap (a large bitmap 1024x768 24bpp). Anyone can tell me if I can load a high resulotion bitmap in an ImageList and why I could load a high resolution JPG image in the imagelist? ...
2
3204
by: A. Solomon | last post by:
Hi, I have a ImageList containing 4 bitmaps attached to a UserControl which acts as a Open/Close panel. This panel, upon click, switches the image in a PictureBox control to indicate the current panel status (Open/Close). Problem is that in certain complex scenarios the images disappear! from the ImageList. That is, when I call: imageList.Images, I get
2
1604
by: Minh | last post by:
Everytime I Use ImageList Control to add Image that has more than 256Bits colours and then an Exception throws at the line: this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); All I have to do is create new Windows Application Project, then add an ImageList Control to the form and then add an image likes 16bit colors to Imagelist. Then Run.
1
1242
by: VBTricks.de.vu Webmaster | last post by:
Hello, I created an application (Windows Forms) with a form and an imagelist. Everything works fine under WinXP, but when I try to start the app on Win98, the following error is returned: Quote: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System InvalidOperationException: Failed to load ImageList. at System.Windows.Forms.ImageListStreamer..ctor(SerializationInfo info,
2
1360
by: Michael Maes | last post by:
Hi, We have been using ImageLists in our Projects extensively. Many forms have two ILs with nearly 900 bmp's each. They are configured: 32Bit, Fuchsia, 16x16 (and one 24x24). In VS2003 there was no issue with this. Upgrading to VS2005 however makes it impossible to open those forms in Design-View. We have tested it with a blank project, and yes, even then it does not work.
4
14502
by: Archimed | last post by:
Hi, I try to use an ImageList with a ListView but that don't work. I make a ListView in VirtualMode with LargeIcon view. I put the ImageList in the LargeImageList property. I add a bitmap to the ImageList When i want to see the item "icon" with the imagelist imageindex
0
2445
by: gene kelley | last post by:
(using VS2005) I want to add an icon to TreeView nodes. 1) To a new project (VB or C#) I add a sample TreeView with some sample nodes. I add an ImageList component, and add one icon image. I set the TreeView ImageList property to the ImageList component and observe the expected results in the TreeView as displayed in the IDE. However, this simple example will not compile and run. It throws an unhandled exception in the Form's...
0
9901
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
11025
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10682
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10758
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10371
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7082
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5942
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4562
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3187
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.