hi i have picturebox with displaying image when i click on button its fine…
but when i close the application and again i run the application it does not shows the last uploaded image and this is my code ….
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
openFileDialog1.FileName = @"D:\";
openFileDialog1.Filter = "png files (*.png)|*.png|jpg files (*.jpg)|*.jpg";
openFileDialog1.CheckFileExists = true;
openFileDialog1.CheckPathExists = true;
if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
{
Image image1 = Image.FromFile(openFileDialog1.FileName);
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
pictureBox1.Image = image1;
pictureBox1.BackgroundImage = image1;
}
}
}
i want show the the last uploaded image in picture box when i rerun the application again
Then you need to save the location and load it again when the application starts.
From the
Solution Explorer, open thePropertieswindow and open theSettingstab. Create a string called LastImage.From code, you can save it:
and read it back when you open: