Bonjour tous le monde
je suis sur une application VB6 j'utilise un code que j'ai trouvé ici pour charger les images le hic c'est qu'il affiche que l'image par défaut "anonymous" les images sont effectivement enregistrer mais pas affichés sur Form je galère depuis toute la journée
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Command3_Click() Dim FicDest As String Dim ficSource As String Dim reponse As Byte 'Attribue à CancelError la valeur True dlg.CancelError = True On Error GoTo errhandler ' Définit la propriété Flags dlg.Flags = cdlOFNHideReadOnly ' Définit les filtres dlg.Filter = "Tous les fichiers (*.*)|*.*|Fichiers image" & _ "(*.jpg)|*.jpg|Fichiers batch (*.bat)|*.bat" ' Définit le filtre par défaut dlg.FilterIndex = 2 ' Affiche la boîte de dialogue Ouverture dlg.ShowOpen ' Affiche le nom du fichier sélectionné txtImg.Text = dlg.FileTitle FicDest = App.Path & "\images\" ficSource = dlg.FileName If FSO.FileExists(FicDest & dlg.FileTitle) = False Then FSO.CopyFile ficSource, FicDest Else reponse = MsgBox("le fichier existe déjà, voulez vous l'écraser?", vbYesNo, "Attention") If reponse = vbYes Then FSO.CopyFile ficSource, FicDest, True Else Exit Sub End If End If Exit Sub errhandler: 'L'utilisateur a cliqué sur Annuler Exit Sub End Sub
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
36
37
38
39
40
41
42
43
44
45 Private Sub Form_Load() Dim rs As String Dim delta As String Set conn = New ADODB.Connection conn.Provider = "Microsoft.jet.OLEDB.3.51" conn.ConnectionString = App.Path & "\dbRente.mdb" conn.Open Set rsIdentif = New ADODB.Recordset rs = "Select * from Identif" rsIdentif.Open rs, conn, adOpenKeyset, adLockOptimistic, adCmdText rsIdentif.AddNew txtNr.Text = rsIdentif.RecordCount + 1 txtNr.Locked = True With Combo1 .AddItem "Lui-meme" .AddItem "Veuve" .AddItem "Ayants-Droits" End With Combo1 = "" txtNom.Text = "" txtPrenom.Text = "" txtNaissance.Text = "" txtAccident.Text = "" txtAdresse.Text = "" txtRente.Text = "" txtEmployeur = "" txtMannuel = "" txtTauxIpp = "" With Combo2 .AddItem "Rente" .AddItem "Reversion" End With Combo2 = "" If txtImg <> "" Then ChPhotos = App.Path & "\images\" & txtImg.Text Ima2.Picture = LoadPicture(ChPhotos) Else ChPhotos = App.Path & "\images\anonymous.jpg" End If Command1.BackColor = RGB(255, 255, 150) With txtNr .Enabled = False .BackColor = RGB(255, 200, 200) End With End SubMerci pour ceux qu'ils veulent bien m'aider
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 Private Sub Timer1_Timer() Dim ChPhotos As String If Command1.Visible = True Then If txtImg.Text <> "" Then ChPhotos = App.Path & "\images\" & txtImg.Text Ima2.Picture = LoadPicture(ChPhotos) Else ChPhotos = App.Path & "\images\anonymous.jpg" End If End If End Sub
Partager