Command1_Click (Index As Integer) Dim r As Integer For r = 0 To UBound(Command1) If r = Index Then Command1(r).BackColor = vbRed ' Celui cliqué Else Command1(r).BackColor = vbBlack ' les autres End If Next r End Sub
Command1(index_du_bouton).BackColor = vbRed
Command1(index_du_bouton).BackColor = vbRedCe n'est pas ce que je cherche à faire!
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionet c'est quoi le soucis dans ce cas?
command1(0) et command1(1) sont bien 2 bouton différents...dans ce cas t'as qu'as mettre le code que je t'ai donné respectivement dans l'évènement click de command1(0) et command1(1)?
Command1_Click (Index As Integer) End Sub
Command1(0)_Click() Command1(0).BackColor = vbRed End Sub
Un simple If dans ta boucle fera l'affaire.
For x = 0 To Command1(Index) If x = Command1(0) then Command1(0).BackColor = vbRed End If If x = Command1(1) then Command1(1).BackColor = vbRed End If ........ ........ ........ Next x
If Command1(0).Value = True Then Command1(0).BackColor = vbRed End If If Command1(1).Value = True Then Command1(1).BackColor = vbRed End If If Command1(2).Value = True Then Command1(2).BackColor = vbRed End If
For r = 0 To UBound(Command1)
For r = 0 To Command1.UBound