Voila c'est un peu plus clair, et assez facile a faire si j'ai bien compris ta question ????
Il faut utiliser la propriété index des boutons de commandes et créer un groupe de bouton :
Nom Bouton1 de index 1 à 5 dans cette exemple
Au chargement on lance la procédure qui choisit un nb aléatoire de 1 à 5 qui sera le bouton gagnant!!
A chaque pression sur un bouton on verifie si c le gagnant :
-Si oui alors affiche c gaganer et demande si on rejoue!!!
-Si non rend non visible le bouton selectionné et attend le nv bouton selectionné
Voila ton code tous fais lol avec 5 boutons a toi de le modifié pour 10 boutons
Dim Gagnant As Integer
Private Sub Command1_Click(Index As Integer) 'Verification If Index = Gagnant Then MsgBox "BRAVO tu as gagner le jeu" If MsgBox("Rejouer ?", vbYesNo) = vbYes Then For i = 1 To Command1.UBound Command1(i).Visible = True Next i Call ChoixAléatoireGagnant Else End End If Else MsgBox "Dommage tu as perdu retente ta chance" Command1(Index).Visible = False End If
End Sub
'Cette exemple utilise 5 bouton de commande 'Index de 1 à 5 Private Sub Form_Load() Call ChoixAléatoireGagnant End Sub
Sub ChoixAléatoireGagnant() Randomize Gagnant = Int(Rnd * 4) + 1 End Sub
|
++