Dim mesFichiers() as string. De plus, tu aura besoin d'une valeur qui t'indique le fichier courant , dans cette liste. un entier devrait amplement convenir !!
'tableau de nom de fichiers Dim MesFichiers() As String Dim Courant As Integer 'bouton precedent Private Sub Command1_Click() If Courant > 1 Then 'si l'on est pas au debut Courant = Courant - 1 ' regarde l'element precedent Command2.Enabled = True ' allume le bouton suivant If Courant 1 Then Command1.Enabled False 'grise le bouton si necessaire End If 'mettre ici le chargement Label1.Caption = MesFichiers(Courant) End Sub 'bouton suivant Private Sub Command2_Click() 'UBound renvoie la taille Max du tableau dynamique If Courant < UBound(MesFichiers) Then 'si on est pas a la fin du tableau Courant = Courant + 1 ' on regardes le suivant Command1.Enabled = True 'on donne la possibilite de revenir. If Courant UBound(MesFichiers) Then Command2.Enabled False 'si on est a la fin , on grise le bouton End If 'on affiche l'element 'ajouter ici le chargement de l'image (LoadPicture......) Label1.Caption = MesFichiers(Courant) End Sub 'bouton ajouter Private Sub Command3_Click() 'le premier ajout provoque une erreur , que l'on recupere On Error GoTo Taille0 Courant = Courant + 1 'on agrandit le tableau ReDim Preserve MesFichiers(Courant) MesFichiers(Courant) = "Fichier " & Courant 'on allume le bouton precedent , si necessaire If Courant > 1 Then Command1.Enabled = True Fin: Label1.Caption = MesFichiers(Courant) Command2.Enabled = False Exit Sub Taille0: 'donne une taille 0 et initialise la premiere case du tableau ReDim MesFichiers(1) MesFichiers(1) = "Fichier 1" GoTo Fin End Sub Private Sub Form_Load() 'initialisation des controles Label1.Caption = "aucune image chargee" Label1.AutoSize = True Command1.Caption = "Precedent" Command2.Caption = "Suivant" Command3.Caption = "Charger une image" Command1.Enabled = False Command2.Enabled = False End Sub