1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim mydir As String = "c:\Documents et Profils\Belo\Mes documents\Mes images"
Dim zz(2) As String
Dim z As String
For Each fichier As String In Directory.GetFiles(myDir)
If fichier.Contains(".") Then
zz = Split(fichier, ".")
z = Trim(zz(1)).ToUpper
If z = "JPG" Or z = "BMP" Then
ListBox2.Items.Add(fichier)
nb_images = nb_images + 1
If nb_images = 1 Then
PictureBox1.ImageLocation = fichier
End If
End If
End If
Next
End Sub
Private Sub ListBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox2.SelectedIndexChanged
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Dim j As Integer
Dim i As Integer
If nb_images > 0 Then
i = Int(Rnd() * 100000)
j = i Mod nb_images
PictureBox1.ImageLocation = ListBox2.Items(j).ToString
End If
End Sub |
Partager