Introduction
Browsing and displaying an image in a picture box tool using Windows Forms application is a very simple task. In this application, we use the following classes/controls:
- OpenFileDialog
- PictureBox
- TextBox
- Button
Main Functions
This functions simply perform the following steps,
- Open a file dialog box so that a user can select an image from his/her machine
- Browse the image
- Display selected image in a picture box on a Form
- Display image file path in text box
Here is the code,
// open file dialog
OpenFileDialog open = new OpenFileDialog();
// image filters
open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
if (open.ShowDialog() == DialogResult.OK) {
// display image in picture box
pictureBox1.Image = new Bitmap(open.FileName);
// image file path
textBox1.Text = open.FileName;
}
What is an image filter?
Image filter is basically a filter that restricts the user to select only the valid image file. You can remove the image filter.

Hashm JavedPosted Nov 10, 2017, 11:01 PM
Hello Dear, Can you please help me to search a image from a folder and display in picture box? Actually I have a image folder in my D drive which has many pictures of employees and i want to search an employee data with employee image. When i search an employee data it shows me all my required data except employee image.
Manjunath STPosted May 3, 2016, 5:22 AM
It is easy n great tutorial.. thank you
subin kPosted Nov 12, 2015, 1:48 AM
Thanks Sir but i need to save the picture ... what to do ??
Ywet Nu Wai TinPosted Jul 1, 2015, 5:29 AM
Great.Thank you
neelesh727.m 7275555958Posted Feb 10, 2015, 5:29 AM
thanks very help full..
saurabhPosted Jun 27, 2013, 3:53 PM
how should i make a large image to size fit of the picture box???
Uyen PhameditedPosted Apr 6, 2013, 4:07 AMEdited Apr 6, 2013, 4:12 AM
Awesome!!! :) but I don't know how to save it into my database :( Could you guide for me?
Uyen PhamPosted Apr 6, 2013, 4:07 AM
Awesome!!! :) but I don't save it into my database :(
Muhammad IrfanPosted Feb 18, 2013, 8:21 AM
Garg, upload your code here and I'll check it.
gourav gargPosted Feb 18, 2013, 6:25 AM
i have write same code but it save all type of files
gourav gargPosted Feb 18, 2013, 6:25 AM
i have write same code but it save all type of files
arunPosted Jan 16, 2013, 2:34 AM
thanks its really work
arunPosted Jan 16, 2013, 2:34 AM
thanks its really work
arunPosted Jan 16, 2013, 2:34 AM
thanks its really work
javad niaziPosted Nov 18, 2012, 11:48 AM
thanks it is very helpfull
shahrukh kiyaniPosted Nov 16, 2012, 5:12 PM
Very Help Full/thanks.....
suriya pPosted Sep 7, 2012, 5:45 AM
nice... its very useful.... and i want to store the image in database. How to do it..... plz help me
Shahid RazaPosted Jun 26, 2012, 7:21 AM
cdfxdxds
sakthi manojPosted Apr 16, 2012, 2:54 AM
Hi Irfan, I need to Delete/Replece the original image file that currently displayed in picture box using C# code. while I'm trying to delete the image file.I caught the below error, <!> Resource Already in use... Thanks in Advance..! regards, -Sakthi Manoj R
eyesark izzoPosted Jan 5, 2012, 1:06 AM
VEry nicely done, thanks
sisay demelashPosted Dec 23, 2010, 4:06 AM
it help me a lot.
Devang RCPosted Dec 9, 2010, 5:23 AM
Thanks.. now I want save this image as datatype = binary in database sql2005/08. can u please give me solution for that.
BELLO GOLAHANPosted Oct 27, 2010, 5:07 AM
fine,pls could you help write it the code in vb.net. my email is [email protected] . thanks for the article.
Mike GoldPosted Jun 24, 2010, 10:11 AM
Nice article, I think that Upload is a bit misleading though indicating to readers that you may be uploading from the internet? how about Read an Image into a Picturebox?