Solved

Need to load images into a picturebox from resources folder C#

Posted on 2014-07-22
3
2,142 Views
Last Modified: 2014-07-23
I'm using a couple of panels stacked on each other When you select something one panel is invisible then the next one appears I wrote it in VB.NET but ran it through a C# Converter. I get an error MissingManifestResourceException was unhandled. I have a Resources Folder with all graphics to be loaded
anyway the line it get hung up on is

picsport.Image = global::My.Resources.Resources.BASEBALL);

Does anyone have an Idea is it a syntax error?
Errormessage.png
0
Comment
Question by:powerztom
3 Comments
 
LVL 16

Accepted Solution

by:
Vikram Singh Saini earned 400 total points
ID: 40213374
There are different possibilities -

1. Since you had converted the VB application to C#, so one suspect is that use of My keyword might be wrong in first place.

I would rather suggest you to use the project's namespace as -

global::Namespace.Resources.Resources.BASEBALL;

2. Please also visit the link - System.Resources.MissingManifestResourceException which suggest ways to fix.

3. What I use to do generally? Right click on image or icon file in Resources folder. Set it as resource. And then try to use as -

// First bold resource is name of folder in which image is residing
Namespace.Resources.Resources.BASEBALL;
0
 
LVL 1

Assisted Solution

by:Sameer Rakshe
Sameer Rakshe earned 100 total points
ID: 40214117
The path should be something like: "Images\a.bmp". (Note the lack of a leading slash, and the slashes being back slashes.)

And then:

pictureBox1.Image = Image.FromFile(@"Images\a.bmp");
0
 

Author Closing Comment

by:powerztom
ID: 40214318
Both EE Experts pointed me in the right direction I was able to fix the problem by right clicking on Resources.resx and Settings.settings in the C# solution, and choosing “Run custom tool”.   Then I reran the C# program, navigated around, and didn’t get the error.
0

Featured Post

The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

829 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