Solved

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

Posted on 2014-07-22
3
2,160 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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…

679 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