Reputation: 29
I have been trying to use the following code to Load an Image from My Resources to A picture Box on Visual Studio 2012 using C#.
pictureBox1.Load(Properties.Resources.Desert);
And I have been getting the following errors.
System.Windows.Forms.PictureBox.Load(string)
has some invalid argumentsSystem.Drawing.Bitmap
to string
Upvotes: 0
Views: 10615
Reputation: 65079
The Load
method takes a string
. You are directly passing it a resource which is a Bitmap
.. this won't work.
Try this:
pictureBox1.Image = Properties.Resources.Desert;
This will directly set the image in the PictureBox
to be the Bitmap
in your resources.
Upvotes: 1