Error converting bitmap to pictureBox in C #?

4

I am creating a path inside C # so I can always call images from this path, I am instantiating a reference ( using namespace.Properties ) and through it I am able to call Resources and using the following code:

var myIcon = (Bitmap)Resources.imagem;

But even so within the pictureBox it does not work, it gives the following error:

  

Can not implicitly convert type 'System.Drawing.Bitmap' to 'System.Windows.Forms.PictureBox' c: \ users \ Lucas \ documents \ visual studio 2015 \ Projects \ test \ test \ / p>

Attempt to call the image:

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

I want inside this pictureBox I can call my image that I'm already calling through Resources , but how can I fix this error?

    
asked by anonymous 18.06.2016 / 18:11

1 answer

4

The problem is in the way you are setting up the picturebox

Correct is pictureBox1.Image=myIcon

    
18.06.2016 / 19:38