Promote Your Blog
Google

Friday, March 2, 2012

How To Display Selected Picture in vb.net

In this post, you will learn, how to:

  • Use OpenFileDialog to choose Jpeg files only
  • How to display selected jpg image

OpenFileDialog2.InitialDirectory = Directory.GetCurrentDirectory

OpenFileDialog2.Title = "Select a File"

OpenFileDialog2.FileName = ""

OpenFileDialog2.Filter = "Jpeg Files (*.jpg)|*.jpg"

OpenFileDialog2.FilterIndex = 1

If OpenFileDialog2.ShowDialog() <> Windows.Forms.DialogResult.Cancel Then

PictureBox1.Image = Image.FromFile(OpenFileDialog2.FileName)

Else

MsgBox(“You Approp. Msg”)

End If

No comments:

Post a Comment