You are on page 1of 1

1.

From toolbox add OpenDialog tool


2. Then put the below code to the button your going to use

private void button2_Click(object sender, EventArgs e)


{
OpenFileDialog f = new OpenFileDialog();
f.Filter = "JPG(*.JPG)|*.jpg";

if (f.ShowDialog() == DialogResult.OK)
{
//txtNo.Text = ;
Files = Image.FromFile(f.FileName);
pictureBox1.Image = Files;
}
}

Code for Reading Image from folder

pictureBox1.Image = Image.FromFile(@"C:\Users\PRINCETON\Documents\Visual Studio 2010\Projects\prjREAD_WRITE_TextFile\Photos\" + txtNo.Text + ".jpg");

Code for Saving Image to Folder

pictureBox1.Image.Save(@"C:\Users\PRINCETON\Documents\Visual Studio 2010\Projects\prjREAD_WRITE_TextFile\Photos\" + txtNo.Text + ".jpg");

You might also like