0

I want to display an image in a picture box which I have saved in my solution folder.

enter image description here

Is there an easy way for this to be done? I have seen examples of loading from resources using streams etc. But that seems far too much code for what I'm trying to do.

    if (ds.Tables[0].Rows[0]["GDPRState"].ToString() == "1")
    {
         picture_GDPR.Image = Image.FromFile("");
    }

Do I want to be using the FromFile function to achieve this?

benjiiiii
  • 468
  • 8
  • 30

1 Answers1

0

https://www.youtube.com/watch?v=LQMDsJgMXhE

The above YouTube video helped explain it to me.

I had just copied my image into the directory and not added it as a resource. When I had added it correctly the following code worked.

picture_GDPR.Image = Properties.Resources.gdpr_test;
Zoe stands with Ukraine
  • 25,310
  • 18
  • 114
  • 149
benjiiiii
  • 468
  • 8
  • 30