Open an image using open file dialog

Here you can open an image using an open file dialog.
use the open file dialog control and button.
And put 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

Picturedialog.Image = Image.FromFile(OpenFiledialog.FileName)

End If


No responses found. Be the first to comment...

  • 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: