Solved

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

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now