Need help loading a resource file into a picturebox

Hi All,


I'm trying to figure out how to load the images from a resource file into a picturebox. I have searched through on this forum, but most of them are for visual basic and other programming languages, but I can't figured it out for c++.

I have added a picture into the Resources.resx file in the properties folder. I have also added an image called myimage1.png to the resources folder. I need your help because I don't know how I can get access to the Resources.res to load up the images and place the images in the picturebox when I click on the form button. Please can someone help?


Anyone who can help me with this would be much appreicate.

Thanks,
Mark
please can someone help????????
Help with what? You need to post the code that you're having difficulty with. Otherwise we're only guessing.

BTW, this is a C++ forum. Where are you seeing posts about VB and "other programming languages"???
Okay, I have tried this:

1
2
3
4
5
6
private: System::Void button1_Click_1(System::Object^  sender, System::EventArgs^  e) {
			 System::Resources::ResourceManager^ rmngr 
				= gcnew System::Resources::ResourceManager("buttonblue.Resources", 
				this->GetType()->Assembly);
			 Label1->Image = rmngr->GetObject("buttonblue");
		 }



I get an error, the error is error C2664: 'System::Windows::Forms::Label::Image::set' : cannot convert parameter 1 from 'System::Object ^' to 'System::Drawing::Image ^'.


The error are jumping on label1->image argument.

Any idea how to correct the error?
Last edited on
This is that M$ widgets\forum stuff (I always forget what it's called), not real C++. But I can tell you that the first arguement to your function should be of a different datatype.
uh.. should this really be posted in the beginners section? just saying..
@ metl wolf: LOL! Welcome to cplusplus dot com! In all seriousness though, it took me a while to notice that the complexity of the post isn't what determines what section people post it in. It seems to have more to do with the posters confidence in the topic they are asking about. For example, you will often see bone-head questions asked in the general section because the OP refuses to acknowledge that they have been staring at the problem for far too long and they need a break (I for one am VERY guilty of this). At the same time you'll see seemingly complex stuff like this in the Beginners section all of the time. After a while it all just melts together.
Last edited on
@computergeek01
yeah, i know what you mean
Topic archived. No new replies allowed.