Hey guys and gals not quite sure if this is where I should put this, I'm running into a really weird problem that I have yet to encounter...atleast until now. I am using Microsoft Visual C++ and playing with a little toy project using windows forms.

Anyways I have an initial login form that is the first thing that launches, I decided to add a background image by selecting the the form and under properties pointing to BackgroundImage and selecting my .png file.

Now when I try and debug it is giving me the following pop up error:
An unhandled exception of type
'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll

Then it goes on to say that it could not find any resources appropriate for the specified culture or the neutral culture.


So this makes me wonder, in C++/CLI do I need to have the image in the same directory as the project even though it is being stored in the resx file? Does Microsoft Visual C++ prefer JPG, Bitmaps or another image format for form backgrounds instead of PNG?

Now the image is showing up in the login.resx file and after getting the error it points me at the line of code:

this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"$this.BackgroundImage")));

I have tried all sorts of google searches for solutions but I'm still not coming up with anything concrete that seems to be working for me.

Anyone run across this problem and have a fix that actually works?

How about this?

Thanks for the quick response thines. I was half way through reading that document when the email popped up that you had replied. Unfortunately it still isn't giving me a solution....So I'm going to keep looking, on hour four of this issue and at this point I may just try and rebuild everything from scratch as it may save me more time in the long run.

I also saw this.

I didnt want to bump this thread cause it was getting buried but all that was wrong was when I was trying to add a background image through the visual c++ sidebar versus in the code itself, was that "using namespace System::Data;" and using "namespace System::Drawing;" were not being auto-generated(I believe those were the two libraries)....once those were added, she ran without a problem.

By the way Thines I need to try your xml solution for me but I opened visual c++ last night and all my menus decided to rearrange themselves as well half my code which I saved and triple saved is now MIA...headers, cpps, you name it...so I wont be able to tell you if your other solution worked until I can re-write around 1800 lines of code.........Might as well just start the project from scratch.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.