Zebra0.com

visual-basic pictureviewer

Write the code shown below:

'Programmer: Janet Joy
'Picture view: open and view picture
Public Class Form1
    Private Sub mnuExit_Click(sender As Object, e As EventArgs) Handles mnuExit.Click
        End
    End Sub

    Private Sub mnuOpen_Click(sender As Object, e As EventArgs) Handles mnuOpen.Click
        Me.OpenFileDialog1.Filter = "All Pictures|*.bmp;*.gif;*.png;*.jpg|JPG|*.jpg|Bitmaps|*.bmp|GIFS|*.gif|PNG|*.png"
        Me.OpenFileDialog1.FileName = ""
        Me.OpenFileDialog1.ShowDialog()
        If Me.OpenFileDialog1.FileName <> "" Then
            Me.PictureBox1.Load(Me.OpenFileDialog1.FileName)
            Me.Text = Me.OpenFileDialog1.FileName
        End If
    End Sub
End Class

Test your program and try opening several different picture formats.

Save all before moving on to the next step.

NEXT: Code and instructions to view a picture