# [.net] GetManifestResourceStream........

This topic is 4677 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi this is a summary of the problem i have.Lets say that the project is called Console1 and I need to load a .jpg that i keep in the data directory but it seems that i only get a null reference to my backgroundBitmap...
System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
Bitmap backgroundBitmap = new Bitmap(asm.GetManifestResourceStream("console1.data.LevelBack.jpg"));


Could you tell me what's wrong .I'm more a C++ fan so C# is kind of new to me . Thanks a lot !

##### Share on other sites
Three things to look out for:
1) Did you add the image to the project using the Solution Explorer?
2) Did you change the "Build Action" property for the image file to "Embedded Resource"?
3) Did you use the exact spelling and character case for the project's namespace and the file, folder and extension of the resource file?

Detailed instructions and sample code from Microsoft Knowledge Base can be found here:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;319292

Bob

• 10
• 16
• 14
• 18
• 15