Code Snippets

  

VB.NET Source Code


Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 131,820 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,482 people online right now. Registration is fast and FREE... Join Now!





Load bitmap into PictureBox using OpenFileDialog

Use OpenFileDialog to browse to a bitmap image and load into a PictureBox.

Submitted By: Jayman
Actions:
Rating:
Views: 14,864

Language: VB.NET

Last Modified: October 17, 2006
Instructions: Drag a PictureBox from the toolbox to your form and set name to PictureBox1.

Snippet


  1. Dim OpenFileDialog1 As New OpenFileDialog
  2.  
  3.  
  4. With OpenFileDialog1
  5.     .CheckFileExists = True
  6.     .ShowReadOnly = False
  7.     .Filter = "All Files|*.*|Bitmap Files (*)|*.bmp;*.gif;*.jpg"
  8.     .FilterIndex = 2
  9.     If .ShowDialog = DialogResult.OK Then
  10.         ' Load the specified file into a PictureBox control.
  11.         PictureBox1.Image = Image.FromFile(.FileName)
  12.     End If
  13. End With

Copy & Paste


Comments


vinodachu 2008-03-01 01:25:35

thank you for that ,i need a solution to save image to acess database ,i think it has to convert to binary before saving to database pls show me coding for that..!!!!!!!!

jayman9 2008-03-01 16:03:00

You can find a tutorial on how to save an image in binary to an Access database "http://www.vbcode.com/Asp/showsn.asp?theID=13000"

arbalu 2008-07-26 00:51:45

more clear sample here http://developerskb.blogspot.com/2008/07/how-to-use-openfiledialog-for-uploading.html

zumanequeen 2008-08-25 11:02:20

hi im beginner here..why in my vs i didnt see the picturebox n openfiledialog to drag into my form.please help me...pls...tq


Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month