Programmer le Timer en Visual Basic 6.0

Cédric Bat -  
Polux31 Messages postés 7219 Statut Membre -
Bonjour,
Je suis débutant en programmation vb, je voulais avoir comment programmer le Timer.
Merci
Configuration: Windows XP Internet Explorer 6.0

1 réponse

  1. Polux31 Messages postés 7219 Statut Membre 1 204
     
    Bonjour,

    Dans une Form, dépose un Timer (Timer1), un label (Label1) et un bouton de commande (Command1) et colle le code dans l'éditeur VB de la form

    Option Explicit
    
    Private temps As Long
    Private maintenant
    
    Private Sub Command1_Click()
        maintenant = Time    
        Timer1 = True
    End Sub
    
    Private Sub Form_Load()
        Me.Timer1.Interval = 1000
    End Sub
    
    Private Sub Timer1_Timer()
        temps = DateDiff("s", maintenant, Time)
        Me.Label1.Caption = temps
    End Sub


    ;o)
    0