Private Sub Form_Load() List1.AddItem "20/08/2010" List1.AddItem "15/09/2010" List1.AddItem "30/10/2010" End Sub Private Sub List1_Click() ' test si la date indiqué et < ou = à la date du jour If DateDiff("y", Date, List1.List(List1.ListIndex)) > 0 Then Label2.BackColor vbRed: Label2.Caption "Alarme !" Else Label2.BackColor vbGreen: Label2.Caption "En cours" End If End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionprivate sub supprimer_click() list1.removeitem (list1.listindex) call tester end sub Public sub tester() If DateDiff("y", Date, List1.List(0)) < 0 Then Label2.BackColor vbRed: Label2.Caption "Alarme !" Else Label2.BackColor vbGreen: Label2.Caption "En cours" End If If DateDiff("y", Date, List1.List(1)) < 0 Then Label3.BackColor vbRed: Label3.Caption "Alarme !" Else Label3.BackColor vbGreen: Label3.Caption "En cours" End If If DateDiff("y", Date, List1.List(2)) < 0 Then Label4.BackColor vbRed: Label4.Caption "Alarme !" Else Label4.BackColor vbGreen: Label4.Caption "En cours" End If end sub