Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2004

Tip: Looking for answers? Try searching our database.

How to add a manifest resource?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MuZZY - 12 Sep 2004 07:31 GMT
Hi,

I have a WinForms app source code with a batch file containing
compilation script:

csc /t:winexe /r:System.dll /r:System.Drawing.dll
/r:System.Windows.Forms.dll /r:Cassini.dll /win32icon:myicon.ico
/res:myicon.ico, MyCustomIcon /out:MyApp.exe MyForm.cs

which works fine if i compile from command line, but if i use VS.NET,
i get an exception in MyForm.cs on this line:

//-----------------------------------
Icon = new
Icon(Assembly.GetExecutingAssembly().GetManifestResourceStream("MyCustomIcon"));
//-----------------------------------

As i understand i need to add icon myicon.ico as a resource with the
resource name "MyCustomIcon".

How can i do that?

Thank you for any ideas!
Andrey
Sijin Joseph - 12 Sep 2004 15:21 GMT
Everything seems ok, why don't you use ILDASM.exe to check out under
what name myicon.ico has been added as a resource

it will look something like this in the disassembled output

.mresource <resource name>
{

}

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

> Hi,
>
[quoted text clipped - 21 lines]
> Thank you for any ideas!
> Andrey
nzpcmad - 12 Sep 2004 23:08 GMT
You might have to add the .ico file to the project and (under the
Properties) set to "Embedded Resource"

> Everything seems ok, why don't you use ILDASM.exe to check out under
> what name myicon.ico has been added as a resource
[quoted text clipped - 35 lines]
> > Thank you for any ideas!
> > Andrey
MuZZY - 13 Sep 2004 02:20 GMT
> You might have to add the .ico file to the project and (under the
> Properties) set to "Embedded Resource"

That's what i've actually already done.
But i can't find a way to "name" this resource.
Of cource i can go without that, because by default the resource will be
given a name <namespace>.<filename> But i'd like to be able to customly
name it though.

Any ideas would be highly appreciated!

Thank you,
Andrey
nzpcmad - 13 Sep 2004 21:10 GMT
I use C# / Visual Studio 2003.

When I load the icon, I use:

this.Icon = new Icon(System.Reflection.Assembly.GetExecutingAssembly).GetManifestResourceStream("Project
Name.Icon Name.ico"));

This works. I don't have sub-folders. If I did. I believe the path
would then be:

Project Name.Folder Name.Icon Name.ico"

Thanks

> > You might have to add the .ico file to the project and (under the
> > Properties) set to "Embedded Resource"
[quoted text clipped - 9 lines]
> Thank you,
> Andrey

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.