LoadPicture sous condition

Résolu
beber00 Messages postés 20 Date d'inscription dimanche 22 mai 2005 Statut Membre Dernière intervention 23 novembre 2005 - 14 oct. 2005 à 11:03
beber00 Messages postés 20 Date d'inscription dimanche 22 mai 2005 Statut Membre Dernière intervention 23 novembre 2005 - 14 oct. 2005 à 11:10
Bonjour,

Je voudrais afficher une image dans une PictureBOx

Cette image est composé de la manière suivante:

nom.prenom.jpg

or il se peut que ce fichier n'existe pas dans ce cas, il existe une image inconnu.jpg

comme vous l'avez devinez je veux faire en sorte que si le fichier nom.prenom.jpg correspondant à la personne n'existe pas alors il affiche la photo inconnu.jpg

voici mon code mais ca ne marche pas

If App.Path & "\Photos" & TxtNom.Text & "." & TxtPrenom.Text & ".jpg" = Null Then
Photo.Picture = LoadPicture(App.Path & "\Photos\inconnu.jpg")
Else
Photo.Picture = LoadPicture(App.Path & "\Photos" & TxtNom.Text & "." & TxtPrenom.Text & ".jpg")
End If

Je crois que je me plante sur ma condition = Null

Merci pour votre aide

4 réponses

acecel Messages postés 140 Date d'inscription jeudi 6 mai 2004 Statut Membre Dernière intervention 14 octobre 2006
14 oct. 2005 à 11:06
If dir(App.Path & "\Photos" & TxtNom.Text & "." & TxtPrenom.Text & ".jpg") = "" Then
Photo.Picture = LoadPicture(App.Path & "\Photos\inconnu.jpg")
Else
Photo.Picture = LoadPicture(App.Path & "\Photos" & TxtNom.Text & "." & TxtPrenom.Text & ".jpg")
End If
3
BasicInstinct Messages postés 1470 Date d'inscription mardi 5 février 2002 Statut Membre Dernière intervention 20 octobre 2014 12
14 oct. 2005 à 11:07
If dir(App.Path & "\Photos" & TxtNom.Text & "." & TxtPrenom.Text & ".jpg") = "" Then
Photo.Picture = LoadPicture(App.Path & "\Photos\inconnu.jpg")
Else
Photo.Picture = LoadPicture(App.Path & "\Photos" & TxtNom.Text & "." & TxtPrenom.Text & ".jpg")
End If

BasicInstinct
3
acecel Messages postés 140 Date d'inscription jeudi 6 mai 2004 Statut Membre Dernière intervention 14 octobre 2006
14 oct. 2005 à 11:09
Trop tard BasicInstinct
0
beber00 Messages postés 20 Date d'inscription dimanche 22 mai 2005 Statut Membre Dernière intervention 23 novembre 2005
14 oct. 2005 à 11:10
Merci a vous deux

:)
0
Rejoignez-nous