Zebra0.com

visual-basic examplesProfessor Joy: CMSC222 Class Work

Professor Joy: CMSC222 Class Work

Class Work Week 11

Picture Viewer

Public Class Form1
    Dim num As Integer
    Private Sub LstFiles_SelectedIndexChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles LstFiles.SelectedIndexChanged
        Dim file As String = FolderBrowserDialog1.SelectedPath & "/" &
LstFiles.SelectedItem
        Me.Text = file
        Me.PictureBox1.Load(file) 'Displays picture in picture box
    End Sub

    Private Sub BtnFind_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BtnFind.Click
        FolderBrowserDialog1.ShowDialog()
        Me.Text = FolderBrowserDialog1.SelectedPath
        Dim Folder As String = FolderBrowserDialog1.SelectedPath
        Dim S As String
        S = Dir(Folder & "/") 'get first file from Selected Folder
        While S <> ""
            'if it is a jpg add it to the list box
            If S.Contains(".jpg") Then
                LstFiles.Items.Add(S)
                Timer1.Enabled = True
            End If
            S = Dir() 'get next file in same directory
        End While
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
        num = num + 1
        If num >= LstFiles.Items.Count Then
            num = 0
        End If
        Me.Text = num
        LstFiles.SelectedIndex = num
    End Sub
End Class

This web site, and all pages therein, are the sole property and responsibility of Zebra0.com.
It is not endorsed, sponsored, or provided by or on behalf of Montgomery College.