locked
Icon not display in the exe file RRS feed

  • Question

  • I add an icon file (.ico format 16 x 16 size) for a vb.net 2005 windows application.

    It is done through Project Properties -> Application -> Icon ->(Browse that icon).

    Then default icon changed to new icon in the property page.

    And I build the solution. But in bin\Debug folder application exe icon is default.

    How can I get new icon for the exe ?

    Friday, July 20, 2012 3:55 AM

Answers

    • "Then exe icon is that icon."

    So does it work now?

    • But if I delete that icon from project folder, compiler error occures "icon not found"

    Yes, if you delete it, it's not found. The file is requierd because you set it as the application icon. Choose a different icon in the application settings, then you can also delete the ico file.


    Armin

    • Proposed as answer by Mark Liu-lxf Monday, July 23, 2012 5:26 AM
    • Marked as answer by Mark Liu-lxf Friday, July 27, 2012 9:43 AM
    Sunday, July 22, 2012 12:57 PM
  • Setting the icon as the default icon for the application, and including the icon as a resource in your application, are two different things.

    You can use the same file for both, however.

    To add the file as a resource, in Project / Properties / Resources select Add Resource / Add Existing File.

    Once you have set that icon as the application icon, or once you have included it as a resource, you should not delete the file because it is required for building your application.

    • Proposed as answer by Mark Liu-lxf Wednesday, July 25, 2012 9:25 AM
    • Marked as answer by Mark Liu-lxf Friday, July 27, 2012 9:43 AM
    Monday, July 23, 2012 7:57 AM

All replies

  • I did the same for Visual Studio 2012 RC for project Test1 and Test14. Built then closed the projects and in both instances they had the new icons. Am unable to replicate your problem.

    You've taught me everything I know but not everything you know.

    Friday, July 20, 2012 5:43 AM
  • I did these steps.

    Copy icon file into project folder.

    Project Properties -> Application -> Icon ->(Browse that icon)

    save and build.

    Then exe icon is that icon.

    But if I delete that icon from project folder, compiler error occures "icon not found"

    Sunday, July 22, 2012 6:16 AM
    • "Then exe icon is that icon."

    So does it work now?

    • But if I delete that icon from project folder, compiler error occures "icon not found"

    Yes, if you delete it, it's not found. The file is requierd because you set it as the application icon. Choose a different icon in the application settings, then you can also delete the ico file.


    Armin

    • Proposed as answer by Mark Liu-lxf Monday, July 23, 2012 5:26 AM
    • Marked as answer by Mark Liu-lxf Friday, July 27, 2012 9:43 AM
    Sunday, July 22, 2012 12:57 PM
  • Hi Armin

    >> So does it work now?

    >>Yes, if you delete it, it's not found. The file is requierd because you set it as the application icon. Choose a different icon in the application settings, then you can also delete the ico file.

    Yes it is work now.

    But I want to embed that icon without the problem of when deleting that icon.

    How can I add it as a resource file and access that icon in VB.Net app. ?

    Monday, July 23, 2012 7:33 AM
  • Setting the icon as the default icon for the application, and including the icon as a resource in your application, are two different things.

    You can use the same file for both, however.

    To add the file as a resource, in Project / Properties / Resources select Add Resource / Add Existing File.

    Once you have set that icon as the application icon, or once you have included it as a resource, you should not delete the file because it is required for building your application.

    • Proposed as answer by Mark Liu-lxf Wednesday, July 25, 2012 9:25 AM
    • Marked as answer by Mark Liu-lxf Friday, July 27, 2012 9:43 AM
    Monday, July 23, 2012 7:57 AM
  • Hi   Acamar

      >> Once you have set that icon as the application icon, or once you have included it as a resource, you should not delete the file because it is required for building your application.

    But I want to embed that icon without the problem of when deleting that icon

    Set the icon from that resource file.

    Can I create a native resource file for this purpose ?

    Monday, July 23, 2012 11:13 AM
  • Why do you want to delete the icon file?   Why not leave it in the project folder?   What advantage are you expecting to occur as a result of removng the file from the project folder?
    Monday, July 23, 2012 11:53 AM
  • Hi Acamar

    >>Why do you want to delete the icon file?   Why not leave it in the project folder?  

    >>What advantage are you expecting to occur as a result of removng the file from the project folder?

    Because all my external files are not alter when distributing. So I think these are embed within a resource file

    Tuesday, July 24, 2012 6:25 AM
  • What do you mean 'distributing'?  If you set the icon as the application icon it will be included as part of the application installation package.  You do not have to 'distribute' anything other than that installation package.   Even if you could delete the icon out of the project folder and still build the application, that would make no difference to the installation package.  I don't know what you mean by 'external files' and I don't know what you are referring to when you say that they don't get altered.

    What exactly is the problem that you need to deal with if the application icon file is left in the project folder?

    Tuesday, July 24, 2012 6:41 AM
  • Hi Acamar

    I understand ur reply. Follow that way.

    and finally my question is

    How can I access an icon from a resource file in a vb.net 2005 windows application ?

    Tuesday, July 24, 2012 11:35 AM
  • Tuesday, July 24, 2012 12:10 PM
  • Hi Armin

                   me.icon set the form icon

                But I want a code for setting application exe icon

    Wednesday, July 25, 2012 4:22 AM
  • The applciation icon is set from the IDE, as you have already described.  It is not set from code.
    Wednesday, July 25, 2012 5:53 AM
  • ok thats all.

    Finally I copy an icon into project folder.

    1) Then set the application icon and form icon as that icon (browse that icon)

    2) Set the application icon (browse that icon) and form icon is set from code ie. me.Icon=my.Resources.IconFileName (already save icon resource file)

    which is better, 1 or 2 ?

    Wednesday, July 25, 2012 9:33 AM
  • 1) Then set the application icon and form icon as that icon (browse that icon)

    2) Set the application icon (browse that icon) and form icon is set from code ie. me.Icon=my.Resources.IconFileName (already save icon resource file)

    which is better, 1 or 2 ?

    It depends on what you are trying to achieve.  What is the objective of the exercise?

    Wednesday, July 25, 2012 9:44 AM
  • The application icon is the icon that is shown in windows explorer or the exe file properties.

    The icon of a Form is something different. You have one application icon but N (0..X) different forms.

    You do not have to copy an icon into the project folder. Use the project properties and add the icon as a resource.


    Armin


    Wednesday, July 25, 2012 9:48 AM
  • Hi Acamar

    >>It depends on what you are trying to achieve.  What is the objective of the exercise?

    Testing resource file access in application

    Wednesday, July 25, 2012 9:55 AM
  • Testing resource file access in application

    In that case, there is no 'better'.

    You have to have an identifiable outcome in order to evaluate which option is more likely to lead to that result.

    Wednesday, July 25, 2012 10:45 AM
  • yes offcource
    Wednesday, July 25, 2012 12:20 PM