Reputation: 3424
I have set picturebox1 modifier to public and am using this code
ViewForm vf = new ViewForm();
vf.picturebox1.Image = Image.FromFile(Application.StartupPath + "/mark.png");
The code has no errors but it is not setting the image
Upvotes: 0
Views: 1585
Reputation: 36
I think that you need to display the form first, so the properties of the PictureBox can be set.
I test this in my computer and works fine:
ViewForm vf = new ViewForm();
vf.Show();
vf.pictureBox1.Image = Image.FromFile(System.IO.Path.Combine(Application.StartupPath, "Image.png"));
Upvotes: 1