Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Icons already in the EXE

Posted on 2004-08-07
8
Medium Priority
?
366 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 600 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

610 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