Prob Heure déclenchement

Résolu
Moot95 Messages postés 20 Date d'inscription mardi 12 octobre 2004 Statut Membre Dernière intervention 22 octobre 2004 - 19 oct. 2004 à 21:05
cboulas Messages postés 2641 Date d'inscription mercredi 2 juin 2004 Statut Membre Dernière intervention 8 janvier 2014 - 20 oct. 2004 à 19:59
Bonjour je ve déclencher un compte a rebour. Voici ce ke j'ai pour l'instant :
Dim heure As Date

Private Sub Command1_Click()
Timer1.Enabled = True
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
End Sub

Private Sub Form_Load()
heure = DateAdd("h", 3, Now)
End Sub

Private Sub Timer1_Timer()
Label11.Caption = Format(heure - Now, "hh:mm:ss")
End Sub

Le compteur démarre automatiquement et c sa le prob je veux que ce soit ma Command1 qui le déclenche mais je n'y arrive pas

Merci d'avance !

27 réponses

Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
20 oct. 2004 à 00:22
Private Sub Check1_Click()
If Check1.Value = vbChecked Then
Check2.Value = vbUnchecked
Else
Check2.Value = vbChecked
End If
End Sub

Private Sub Check2_Click()
If Check2.Value = vbChecked Then
Check1.Value = vbUnchecked
Else
Check1.Value = vbChecked
End If
End Sub
0
Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
20 oct. 2004 à 01:05
Rem pour n Checkbox
Rem Name = Check1
Rem Index = 1,2,.., à n

Dim b As Boolean

Private Sub Check1_Click(Index As Integer)
Dim i As Integer
If b = True Then Exit Sub
b = True
If Check1(Index).Value = 0 Then
Index = Index + 1
If Index > Check1.Count Then Index = 1
Check1(Index) = 1
End If
For i = 1 To Check1.Count
If i <> Index Then Check1(i).Value = 0
Next
b = False
End Sub
0
Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
20 oct. 2004 à 11:03
Timer1.Interval = heure

je me retrouve avec Timer1.Interval égal à 38280 environ
ce qui ne correspond à rien.
heure étant une date, elle est codée, calculée par rapport à l'année 1900.
(2004 - 1900) = 104 ans --> 37960 jours
37960 jours + 10 mois + 20 jours --> 38280 jours (en gros)

je vois pas très bien ce que vient faire un nombre de jours dans le Timer ????

Daniel
0
Moot95 Messages postés 20 Date d'inscription mardi 12 octobre 2004 Statut Membre Dernière intervention 22 octobre 2004
20 oct. 2004 à 17:50
Pour finir , je voudrai savoir comment exécuter un .exe lorsque le Compteur arrive a 00:00:00 ?
SVP
Merci d'avance !
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cboulas Messages postés 2641 Date d'inscription mercredi 2 juin 2004 Statut Membre Dernière intervention 8 janvier 2014 16
20 oct. 2004 à 17:53
if str(compteur)="00:00:00" then
   call shell("toto.exe")
end if


Chris...
Web : Firstruner - eMail : [mailto:support@firstruner.com Support]
0
Moot95 Messages postés 20 Date d'inscription mardi 12 octobre 2004 Statut Membre Dernière intervention 22 octobre 2004
20 oct. 2004 à 18:12
A la place de compteur je met Timer1 c sa ? puis je met tout cela dans Private Sub Timer1_Timer() ?

Merci d'avance !
0
cboulas Messages postés 2641 Date d'inscription mercredi 2 juin 2004 Statut Membre Dernière intervention 8 janvier 2014 16
20 oct. 2004 à 19:59
Compteur est la variable qui contient le temps restant.

J'ai vu cela dans ton code : (voir dernière Partie verte de ce post)

Label11.Caption = Format(heure - Now, "hh:mm:ss")


Donc il suffit de transformer ce truc en ça :

if str(Format(heure - Now, "hh:mm:ss"))="00:00:00" then call shell("toto.exe")


Chris...
Web : Firstruner - eMail : [mailto:support@firstruner.com Support]
0
Rejoignez-nous