Solved

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

Posted on 2014-07-22
3
2,224 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

726 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