Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Reference to Icon Files

Posted on 2006-11-16
6
Medium Priority
?
204 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
[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
6 Comments
 
LVL 13

Accepted Solution

by:
newyuppie earned 672 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 664 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 664 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

730 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