How do you use OpenFileDialog in choosing an image for PictureBox? (e.g. A user selects a image from the OpenFileDialog and it is shown in the PictureBox)
Can anyone help me with coding this pleasE?
Thank You
J Mahone
How do you use OpenFileDialog in choosing an image for PictureBox? (e.g. A user selects a image from the OpenFileDialog and it is shown in the PictureBox)
Can anyone help me with coding this pleasE?
Thank You
J Mahone
Hi you can do this way :
Private Sub btnBrowsePic_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowsePic.Click
With OpenFileDialog1
.InitialDirectory = "C:\"
.Filter = "JPEGs|*.jpg|GIFs|*.gif|Bitmaps|*.bmp|AllFiles|*.*"
.FilterIndex = 1
End With
If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
With PictureBox1
.Image = Image.FromFile(OpenFileDialog1.FileName)
.SizeMode = PictureBoxSizeMode.CenterImage
.BorderStyle = BorderStyle.Fixed3D
End With
End If
End Sub