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, 6:01 PM EST
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, 1:22 AM EDT
It is easy n great tutorial.. thank you
subin kPosted Nov 11, 2015, 8:48 PM EST
Thanks Sir but i need to save the picture ... what to do ??
Ywet Nu Wai TinPosted Jul 1, 2015, 1:29 AM EDT
Great.Thank you
neelesh727.m 7275555958Posted Feb 10, 2015, 12:29 AM EST
thanks very help full..
saurabhPosted Jun 27, 2013, 11:53 AM EDT
how should i make a large image to size fit of the picture box???
Uyen PhameditedPosted Apr 6, 2013, 12:07 AM EDTEdited Apr 6, 2013, 12:12 AM EDT
Awesome!!! :) but I don't know how to save it into my database :( Could you guide for me?
Uyen PhamPosted Apr 6, 2013, 12:07 AM EDT
Awesome!!! :) but I don't save it into my database :(
Muhammad IrfanPosted Feb 18, 2013, 3:21 AM EST
Garg, upload your code here and I'll check it.
gourav gargPosted Feb 18, 2013, 1:25 AM EST
i have write same code but it save all type of files
gourav gargPosted Feb 18, 2013, 1:25 AM EST
i have write same code but it save all type of files
arunPosted Jan 15, 2013, 9:34 PM EST
thanks its really work
arunPosted Jan 15, 2013, 9:34 PM EST
thanks its really work
arunPosted Jan 15, 2013, 9:34 PM EST
thanks its really work
javad niaziPosted Nov 18, 2012, 6:48 AM EST
thanks it is very helpfull
shahrukh kiyaniPosted Nov 16, 2012, 12:12 PM EST
Very Help Full/thanks.....
suriya pPosted Sep 7, 2012, 1:45 AM EDT
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, 3:21 AM EDT
cdfxdxds
sakthi manojPosted Apr 15, 2012, 10:54 PM EDT
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 4, 2012, 8:06 PM EST
VEry nicely done, thanks
sisay demelashPosted Dec 22, 2010, 11:06 PM EST
it help me a lot.
Devang RCPosted Dec 9, 2010, 12:23 AM EST
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, 1:07 AM EDT
fine,pls could you help write it the code in vb.net. my email is [email protected] . thanks for the article.
Mike GoldTOP 100Posted Jun 24, 2010, 6:11 AM EDT
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?