Bonjour à tous.
J'ai une Form avec 2 boutons et 13 frames nomées Etape1 à Etape13.
j'ai trouvé 2 façon de faire pour que lorsque l'on clic sur le bouton suivant, on passe d'une frame à l'autre.
Si vous trouvez un méthode plus simple, plus rapide je suis preneur.
merci
1er méthode (avec des if):
Private Sub Suivant_Click()
If Etape1.Visible = True Then
Precedent.Enabled = True Etape1.Visible = False Etape2.Visible = True
ElseIf Etape2.Visible = True Then
Etape2.Visible = False Etape3.Visible = True
ElseIf Etape3.Visible = True Then
Etape3.Visible = False Etape4.Visible = True
ElseIf Etape3.Visible = True Then
Etape3.Visible = False Etape4.Visible = True
ElseIf Etape4.Visible = True Then
Etape4.Visible = False Etape5.Visible = True
ElseIf Etape5.Visible = True Then
Etape5.Visible = False Etape6.Visible = True
ElseIf Etape6.Visible = True Then
Etape6.Visible = False Etape7.Visible = True
ElseIf Etape7.Visible = True Then
Etape7.Visible = False Etape8.Visible = True
ElseIf Etape8.Visible = True Then
Etape8.Visible = False Etape9.Visible = True
ElseIf Etape9.Visible = True Then
Etape9.Visible = False Etape10.Visible = True
ElseIf Etape10.Visible = True Then
Etape10.Visible = False Etape11.Visible = True
ElseIf Etape11.Visible = True Then
Etape11.Visible = False Etape12.Visible = True
ElseIf Etape12.Visible = True Then
Etape12.Visible = False Etape13.Visible = True Suivant.Enabled = False
End If
End sub
|
2eme méthode (avec salect case):
Public intCompteur as integer
Private Sub Form_Load()
intCompteur = 1 Precedent.Enabled = False
Etape1.Visible = True Etape2.Visible = False Etape3.Visible = False Etape4.Visible = False Etape5.Visible = False Etape6.Visible = False Etape7.Visible = False Etape8.Visible = False Etape9.Visible = False Etape10.Visible = False Etape11.Visible = False Etape12.Visible = False Etape13.Visible = False
End Sub
Private Sub Suivant_Click()
Select Case intCompteur
Case 1 Precedent.Enabled = True Etape1.Visible = False Etape2.Visible = True intCompteur = intCompteur + 1 Case 2 Etape2.Visible = False Etape3.Visible = True intCompteur = intCompteur + 1 Case 3 Etape3.Visible = False Etape4.Visible = True intCompteur = intCompteur + 1 Case 4 Etape4.Visible = False Etape5.Visible = True intCompteur = intCompteur + 1 Case 5 Etape5.Visible = False Etape6.Visible = True intCompteur = intCompteur + 1 Case 6 Etape6.Visible = False Etape7.Visible = True intCompteur = intCompteur + 1 Case 7 Etape7.Visible = False Etape8.Visible = True intCompteur = intCompteur + 1 Case 8 Etape8.Visible = False Etape9.Visible = True intCompteur = intCompteur + 1 Case 9 Etape9.Visible = False Etape10.Visible = True intCompteur = intCompteur + 1 Case 10 Etape10.Visible = False Etape11.Visible = True intCompteur = intCompteur + 1 Case 11 Etape11.Visible = False Etape12.Visible = True intCompteur = intCompteur + 1 Case 12 Etape12.Visible = False Etape13.Visible = True Suivant.Enabled = False intCompteur = intCompteur + 1 End Select
End Sub
|
pour le bouton precedent c'est +/- la même chose
Lemagicien