Solved

Reference to Icon Files

Posted on 2006-11-16
6
200 Views
Last Modified: 2010-04-23
I am trying to use the same icon in all forms of a VB.NET, as well as in installation shortcuts.  I can go through one form at a time and assign an incon file to each.  

The results are erratic.  Sometimes VB insists on copying or moving the icon file to a different directory.  For example, if the icon file is stored in the project/bin directory it will automatically move it to the project/ directory.   Then if I reasign the forms to the moved file, it later gets deleted or removed again.  Then it wont compile because it cant find the icon file.

I tried assigning the icon file as a project resource but the behaviour is still erratic.

Is there a way to assign the icon file to each form within the code?

Also, in general, when I get an complation error message about an invalid reference - cant find file etc....  How do I find out where in my project that invalid reference is located so that I can fix it?

Bill
0
Comment
Question by:BW999
6 Comments
 
LVL 13

Accepted Solution

by:
newyuppie earned 168 total points
ID: 17957164
why dont you place the icon in the application resources, set it's embedded property to TRUE. then to modify the form icon by code would be something like

Me.Icon = New Icon(My.Resources.MyIcon, My.Resources.MyIcon.Size)

in the New or Load event.
0
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 166 total points
ID: 17957233
Hi BW999,

Create a form with no code in it, set this form's Icon property to what you want and inherits every form of your application from this base form.

If you ever need to change the icon, go back to this base form, change it and recompile.

Cheers!
0
 
LVL 14

Assisted Solution

by:jake072
jake072 earned 166 total points
ID: 17965687
Or having a combination of both solutions would work well as well.  You can have the embedded resource, and inherit the form.  (Personally, this is what I have done in some of my own projects -Add the resource and inherit the form that is).

Jake
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
.NET tools for adding thread safety to a web app? 3 48
Need a starter for ETL protocol? 4 65
.NET 2008 VB and C# 6 39
Get month and date in a format 4 31
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

861 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