Open File Dialog Control

Here is code to use open file dialog control in a windows based application

put a File dialog control on the form and a button
and add the below code in the button click


OpenFiledialog.Filter = "Image Files|*.jpg;*.gif;*.bmp;*.png;*.jpeg|All Files|*.*"
OpenFiledialog.InitialDirectory = "C:\"
OpenFiledialog.FilterIndex = 1

OpenFiledialog.Title = "Open File"
If (OpenFiledialog.ShowDialog() = Windows.Forms.DialogResult.OK) Then
thumb = OpenFilephoto.FileName
Picturephoto.Image = Image.FromFile(thumb)
End If


Comments

Author: Gaurav15 Dec 2010 Member Level: Bronze   Points : 1

Check this usefull link related to this topic
http://www.mindstick.com/Articles/efa33125-fcae-432e-b77c-737c927796f4/?OpenFileDialog Control in VB.Net



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: