Solved

Reference to Icon Files

Posted on 2006-11-16
6
197 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 69

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now