How do I change a PictureBox's image?

135,053

Solution 1

If you have an image imported as a resource in your project there is also this:

picPreview.Image = Properties.Resources.ImageName;

Where picPreview is the name of the picture box and ImageName is the name of the file you want to display.

*Resources are located by going to: Project --> Properties --> Resources

Solution 2

You can use the ImageLocation property of pictureBox1:

pictureBox1.ImageLocation = @"C:\Users\MSI\Desktop\MYAPP\Slider\Slider\bt1.jpg";
Share:
135,053
Steven
Author by

Steven

Updated on December 18, 2020

Comments

  • Steven
    Steven over 3 years

    I have a program in C# with a PictureBox object inside a Form. How do I change its picture? The pictures to chose from are in bin/Pics; they are jpeg in format, if that matters..