473,322 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

resources.GetObject("imageList1.ImageStream") throws System.Reflection.TargetInvocationException

Hi,

I was in trouble with the System.Windows.Forms.ImageList control from
VC.NET. I was doing the following :

1. New Project, C#, Windows Application
2. Add ImageList component imageList1 to Form1
3. in imageList1 properties open the 'Image Collection Editor' for
Images
and add a simple copy.bmp
4. build and run the application

What I get here is an TargetInvocationException at this line
this.imageList1.ImageStream =
((System.Windows.Forms.ImageListStreamer)(resource s.GetObject("imageList1.Im
ageStream")));

I finally found a solution for that and I just want to post it for
others who may encounter this problem.

VC.NET is using an application manifest to enable visual styles within
the IDE with "devenv.exe". I don't know why but the problem cames from
that manifest file. To fix the problem, create a manifest file and name
it yourappname.exe.manifest

Paste this code into that file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="WindowsXP"
type="win32"
/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

Now, use this file for any application you want to use XP styles for,
including VS.NET. You can put this manifest file in the .NET app
folder. Run VS.NET and you'll see xp styles. Make sure "flatstyle" for
your buttons and frames is set to "system".

Nov 17 '05 #1
0 7900

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

Similar topics

0
by: Rae | last post by:
Using a code behind, I am uploading a file to an FTP server. 1. Check the directory selected. 2. Check that the filename does not already exist on the ftp server, if it does, rename it and check...
0
by: Adrian | last post by:
Hi I get the above error when Windows updater tries to install KB 886903 .net framework update!! Any idea what's going on? XP Pro SP2
0
by: Mauro | last post by:
Hi, i'm testing my application on XP and on W2k. On XP it works, but when i try to run my application (after installation) on Windows 2000 i receive this error message: "An Exception...
1
by: melanieab | last post by:
Hi again, I'm trying to programatically sort a datagrid. I did find the following code, and it does work, but, when a column header is clicked, the data only sorts in descending order. Clicking...
0
by: Gemma M | last post by:
Hi, I have a C# program (code fragment below), which runs forever, processing incoming jobs. Part of this program launches a COM object. However, after a while I get : ...
1
by: Patrick | last post by:
Has been trying to get an ASP.NET DLL's modification date/time for the "release date/time" to be displayed on the page's footer Using: System.Reflection.Assembly...
0
by: Sutabi | last post by:
I'm trying to compile a "Release" build of a project, and in debug more it compiles and runs fine. In release mode it builds, but does not run and returns this exception. I have no idea what this...
3
by: groovyjman21 | last post by:
Hi, I am using FXCop on my c# project and it is complaining about signing the assembly with a strong name key. All the documentation I can find says to do: using System.Reflection; .... ...
9
by: Michael Sander | last post by:
Hello ng, anyone knowns how to add a reference to an assembly to System.Reflection.AssemblyBuilder? In System.Web.Compilation.AssemblyBuilder is a function like AddAssemblyReference, but not in...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.