Compte a rebour avec la posibiliter de choisir le nombre de départ et la fonction a effectuer une fois que le décompte est arivé a 0
avec un bug en - : avant quand on inscrivez du text a la place de nombre dans la textbox sa plantez, plus maintenant !!
Source / Exemple :
Option Explicit
' Source par OverDarck
' za511@aol.com
' pour tout commantaire, remarque ou modification concernant ce programme, envoyer moi un mail
Public i As Integer
Dim Ttr
Private Sub form_unload(cancel As Integer)
End
End Sub
Private Sub Command1_Click()
Dim NB
If Command1.Caption = "Exit !" Then
Unload Me
Else
If Command1.Caption = "Stop !" Then
Text1.Enabled = True
Timer1.Enabled = False
NB = Label1.Caption
Text1.Text = NB
Command1.Caption = "Exit !"
Command1.Left = 1080
Command1.Top = 1560
cmd1.Visible = True
End If
End If
End Sub
Private Sub Form_Load()
Command1.Caption = "Exit !"
Ttr = False
Timer1.Enabled = False
End Sub
Private Sub cmd1_Click()
On Error GoTo eror
If Text1.Text = "Specifier la durée ici" Then
MsgBox ("vous devez specifier une durée"), vbCritical + vbOKOnly, "Compte a Rebour"
Else
If Timer1.Enabled = False Then
If Command1.Caption = "Exit !" Then
If Text1.Text = "" Then
MsgBox ("vous devez specifier une durée"), vbCritical + vbOKOnly, "Compte a Rebour"
Else
i = Text1
GoTo debut
debut:
If Err Then '2
Dim ret
ret = MsgBox((Error$(Err)), vbCritical + vbRetryCancel, "Compte a Rebour")
If ret = vbRetry Then '3
GoTo debut
ElseIf ret = vbCancel Then
Exit Sub
End If '3
Else
GoTo suite1
End If
suite1:
Command1.Left = 600
Text1.Enabled = False
cmd1.Visible = False
Label1.Enabled = True
Timer1.Enabled = True
Command1.Caption = "Stop !"
If Val(Text1.Text) > 100 Then
Me.Caption = "Compte a Rebour !"
Command1.Left = 960
Me.Width = 2865
Label1.Width = 2535
Else
Command1.Left = 1080
Me.Width = 2080
End If
GoTo suite
End If
End If
End If
End If
eror:
suite:
Exit Sub
End Sub
Private Sub text1_click()
Text1.Text = ""
End Sub
Private Sub Timer1_Timer()
On Error GoTo eror
Dim x As Long
If Val(i) > 100 Then
Command1.Left = 960
ElseIf Val(i) > 10 Then
Command1.Left = 600
Label1.Width = 2535
Me.Caption = "Compte a Rebour !"
End If
If Val(i) < 11 Then
Command1.Left = 120
Me.Width = 1125
Text1.Width = 735
Label1.Width = 900
Me.Caption = "C a R !"
ElseIf Val(i) < 101 Then
Me.Caption = "Compte a Rebour !"
Me.Width = 2080
End If
suite:
i = i - 1
Label1.Caption = i
If i = 0 Then
'metez ici l'action a effectuer a la fin du compte
x = MsgBox("BBBBOOOOMMMM !!!", vbCritical, "BOOM !!")
End
End If
Timer1.Enabled = False
Timer1.Enabled = True
eror:
If Err Then '2
Dim ret
ret = MsgBox((Error$(Err)), vbCritical + vbRetryCancel, "Compte a Rebour")
If ret = vbRetry Then '3
GoTo eror
ElseIf ret = vbCancel Then
End If '3
End If
End Sub
Conclusion :
Je savai pas dans quelle categorie metre ca alors je l'ai mis ici
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.