Share via


Added some .png's to project resources, but I can't seem to access them at all.

Question

Saturday, January 9, 2010 4:54 AM

I added a bunch of .png's to my project's resources.  In code, I try to refer to them by saying "ProjectName.Resources.FileName" but they're not coming up at all.  They show up in the Resources node for the project in the Solution Explorer, and their properties are set to BuildAction = none, Copy To Output Directory = Do not copy.

Oddly enough, I have a bunch of other .png's that I added a few months back and they work fine.  But the batch I added the other day...not so much.

All replies (6)

Friday, January 15, 2010 6:51 AM âś…Answered

Hi 0to60,

Thank you for your reply and clarification.

Its VS2008 Professional, a C#, WinForms project.

Months ago, I had added a bunch of .png's to the project's Resources with BuildAction=none (I don't know if that's significant to this question) and they show up in Intellisense just fine.  But these latest .png's, they just don't show up.  I can't see what I'm doing wrong. 

Let's start with this: how could you add .png's to your Resoures and have them NOT show up in Intellisense?  Is that possible?  Because that's prolly what my problem is...

Some clarification with you:
**
Q1:**
Do you mean that you cannot find PNG names that you added in your resources file via Intellisense as the following screen shot?

**Q2:
**Will this scenario happen when you create a new C# Winform project?

I would suspect that your issue can be related to Visual Studio 2008 IDE instead of programming.

For your issue, could you please help me to check the following steps for further troubleshooting?

  • Open your resources file to check whether these "latest PNG files" have been added successfully into your resources file
  • Check "Access Modifier" in Resource Designer that is not set to "No code generation"
       For more information on Resource Designer, please check: http://msdn.microsoft.com/en-us/library/t69a74ty.aspx
  • If the above suggestion doesn't work, to eliminate the possible cause of IDE settings, please run devenv.exe /ResetSettings in Command Prompt, which restores the default Visual Studio settings

If the problem still exists, it would be great that you could post the screen shot of your issue so that I can understand the situation better.

Thank you for your help.

Hope this helps! If you have any concern, please feel free to let me know.

Best regards,
Yichun Chen
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact [email protected]Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.


Monday, January 11, 2010 9:00 AM

Hi 0to60,

I added a bunch of .png's to my project's resources.  In code, I try to refer to them by saying "ProjectName.Resources.FileName" but they're not coming up at all.  They show up in the Resources node for the project in the Solution Explorer, and their properties are set to BuildAction = none, Copy To Output Directory = Do not copy.

Oddly enough, I have a bunch of other .png's that I added a few months back and they work fine.  But the batch I added the other day...not so much.

Based on your description, it seems that you have some concern on loading PNG files from Resources file.

Some clarification with you:
What kind of project is this existing project? Winform application, website or others? VB.NET project, C# project or others?
Is this project created by Visual Studio 2008?
Please provide me more information on the project so that I can try to reproduce the scenario that you came across.

According to your description, I tried to create a new Winform application on my machine >> add one Resources file (BuildAction property is "Embedded Resource") >> add several PNG files the Resources file >> drag and drop one Picturebox on the form >> write down the following code snippet (in VB.NET):

Imports System.Resources

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        PictureBox1.Image = My.Resources.Resource1.SQL_Server_2005_Feature1
    End Sub
End Class

When I debugged this application, I could notice this picture (SQL_Server_2005_Feature1.PNG) in the Picturebox.
When I set BuildAction property from "Embedded Resource" to "None" and rebuilt the project, the picture missed.

For BuildAction Property, it returns or sets the build action to perform with the file. This value determines what the project system does with a project item during a build.
For "Embedded Resource", this file is embedded in the main project build output as a DLL or executable. It is typically used for resource files.
If we set this property to "None", this means that "No action is taken" when the project is built. This build action will not include the file in the application package or assembly. We usually apply this option for resource files that you want to retrieve on demand. You will typically deploy on-demand files at the same server location as your application package.
I would suspect that that's the reason why you cannot see the picture to be shown.
For more information, please check: http://msdn.microsoft.com/en-us/library/0c6xyb66.aspx

Hope this helps! If you have any concern, please feel free to let me know.

Best regards,
Yichun Chen
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact [email protected]Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.


Thursday, January 14, 2010 4:07 PM

Its VS2008 Professional, a C#, WinForms project.

Months ago, I had added a bunch of .png's to the project's Resources with BuildAction=none (I don't know if that's significant to this question) and they show up in Intellisense just fine.  But these latest .png's, they just don't show up.  I can't see what I'm doing wrong. 

Let's start with this: how could you add .png's to your Resoures and have them NOT show up in Intellisense?  Is that possible?  Because that's prolly what my problem is...


Monday, January 18, 2010 3:11 PM

I can't get the window that you have in your screenshot.  I've seen it before, but I can't figure out how to open it.  If I doubleclick the resources folder within the Solution Explorer, it expands the resources node like a treeview.  Nowhere is there an "open" menu item or button.  When I doubleclick an individual resource it just opens a .bmp editor.  How do I get that window that you have in your screenshot?


Tuesday, January 19, 2010 2:57 AM

Hi 0to60,

Thank you for your reply.

I can't get the window that you have in your screenshot.  I've seen it before, but I can't figure out how to open it.  If I doubleclick the resources folder within the Solution Explorer, it expands the resources node like a treeview.  Nowhere is there an "open" menu item or button.  When I doubleclick an individual resource it just opens a .bmp editor.  How do I get that window that you have in your screenshot?

Resource file has the extension of .resx. It doesn't mean Resources folder.
For more information of resource file, please check: http://msdn.microsoft.com/en-us/library/ekyft91f.aspx.
That's why you cannot get the windows in my previous screen shot.

To access the Windows in my screen shot, please open *.resx file instead of Resources folder.
Please check this screen shot:

Hope this helps! Look forward to your reply. If you have any concern, please feel free to let me know.

Best regards,
Yichun Chen
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact [email protected]Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.


Friday, January 22, 2010 5:21 AM

Hi 0to60,

Does the above suggestion work?

I've marked my reply as answer. If you have any concern, you can unmark my reply and let me know.

Best regards,
Yichun Chen
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact [email protected]Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.