Error converting bitmap to pictureBox on C#?

Asked

Viewed 133 times

4

I’m creating a path within C# to always be able to call images from this path, (using namespace.Properties) and through it I am able to call the Resources and using the following code :

var myIcon = (Bitmap)Resources.imagem;

But even so inside the pictureBox it does not work, :

Cannot implicitly Convert type 'System.Drawing.Bitmap' to 'System.Windows.Forms.Picturebox' test c: users Lucas Documents visual studio 2015 Projects test Form1.Cs 31 Active

Attempt to call the image :

var myIcon = (Bitmap)Resources.imagem;
pictureBox1 = myIcon;

I want you in this pictureBox I can call my image I’m already calling through the Resources,but how can I fix this mistake ?

1 answer

4


The problem is in the way you are setting the picturebox

the correct is pictureBox1.Image=myIcon

  • 1

    Thank you very much, :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.