Display an Image in PictureBox in Runtime - Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

This is a tutorial on how to browse for an image and display it on a picture box during run time in visual basic .net

During runtime, the user will click on a button, an open file dialog will apear, then the user will locate the image desired, then clicks ok. The image will apear in the picturebox

Browse Button Click Event Code

Dim OpenFileDialog1 As New OpenFileDialog
        With OpenFileDialog1
            .CheckFileExists = True
            .ShowReadOnly = False
            .Filter = "All Files|*.*|Bitmap Files (*)|*.bmp;*.gif;*.jpg"
            .FilterIndex = 2
            If .ShowDialog = DialogResult.OK Then

                PictureBox1.Image = Image.FromFile(.FileName)

            End If
End With


Share This

Home | About | Contact | Privacy Policy

Copyright visual-basic-tutorials.com 2017 - All Rights Reserved.