1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
Using ofd As New OpenFileDialog
With ofd
.Title = "Sélectionnez un fichier"
.CheckFileExists = True
.FilterIndex = 1
.Filter = "Images|*.bmp;*.gif;*.jpg;*.jpeg;*.png"
If .ShowDialog = DialogResult.OK Then
Dim fi As New FileInfo(.FileName)
If fi.Length <> 0 Then
TxbBackgroundDesktop.Text = .FileName
Else
If MessageBox.Show("Le fichier sélectionné est vide (0 octet) !!", "Attention", MessageBoxButtons.yesno, MessageBoxIcon.Question) = DialogResult.Yes Then
Msgbox("A titre d'exemple")
End If
End If
Else
TxbBackgroundDesktop.Text = lastFileNameUsed
End If
End With
End Using |
Partager