I added three images to a file called Resource1.resx. I also added one string just for test purposes. I\'m getting this error on either the GetString or the GetObject(image
I had the same problem today on a VS-designer-built winform. I had added an image to an item of a menuStrip:
this->menuitemFileSettings->Image = (cli::safe_cast
(resources->GetObject(L"menuitemFileSettings.Image")));
Since then the same error came up. Testing with images on other controls was the same.
Somehow I finally stumbled over the "Managed Resources" entry in the project settings. The setting "resource file name" has the (default) value $(IntDir)\$(RootNamespace).$(InputName).resources... which is correct, but when I realized that the path contains the name of the namespace, I checked the namespace and found, that I had changed it (from NS_Winform to NS_assemblies) for easier import of the assemblies.
Changed it back, working fine now. :-)
But I still don't understand, how the resources content
1) was included into the exe despite the wrong namespace, and
2) not found then although included.