Solved

Icons already in the EXE

Posted on 2004-08-07
8
362 Views
Last Modified: 2010-04-23
In the project properties, I set my application's default icon which, in turn, added it to the resources or whatever you want to call it.. it's compiled in with the exe.. I plan on doing this with all my icons but I need to know how to get the icons in the form of System.Drawing.Icon so they can be accepted in most controls. Thanks in advance.
0
Comment
Question by:UrbanPuppet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11745107
dim stream as Stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("namespace.objectname")
dim i as Icon = new Icon(stream);
0
 

Author Comment

by:UrbanPuppet
ID: 11745136
Stream isn't a type, so that code isn't working; how would I get it to work?
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11745150
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11745154
are you importing System.IO ?

what about System.Reflection for the assembly class ?

0
 

Author Comment

by:UrbanPuppet
ID: 11745176
Ok, sorry, did that and now it's almost working, I just don't know what to put for namespace.objectname .. the project is called XSM and the icon is called icoMain.ico but XSM.icoMain.ico didn't work. I've raised the points a little too.
0
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 150 total points
ID: 11745185
What is the default namespace for your project ?

Also it is case sensitive ...

http://www.dotnetspider.com/Technology/KBPages/442.aspx gives further examples of using GetManifestResourceStream.
0
 

Author Comment

by:UrbanPuppet
ID: 11745210
OK, thanks, that link helped a lot.. But i had after I tinkered with your first post.. I just needed to change the icon to an embedded resource..

The final code ended up like this:

Dim Stream As System.IO.Stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("XSM.icoMain.ico")
Dim i As Icon = New Icon(Stream)

frmMain.Icon = i
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11745216
you could just use

imports System.IO
imports System.Reflection

glad you could get it working ...

Cheers,

Greg
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question