Solved

Reference to Icon Files

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
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…
Suggested Courses

617 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