Can you help me make 1 minute stopwatch in vb6?

Asked By 20 points N/A Posted on -
qa-featured

I'm practically new to Visual Basic.  As my first project, I'd like to create a stable 1 minute stopwatch in vb6, I'd like it to ping an event every 1 minute and be synchronized with the system clock.  I'm using Visual Studio 2010 on OS XP 64 bit.  Suggestions anyone?

SHARE
Answered By 0 points N/A #198406

Can you help me make 1 minute stopwatch in vb6?

qa-featured

Hi, you can try these codes .

Dim seconds, minutes, hours As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Interval = 1000
Timer1.Start()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Stop()
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If seconds = 60 Then
seconds = 0
minutes = minutes + 1
End If
If minutes = 60 Then
If seconds = 60 Then
seconds = 0
minutes = 0
hours = hours + 1
End If
End If
seconds = seconds + 1
TextBox1.Text = Format(hours, "00") & "." & Format(minutes, "00") & "." & Format(seconds, "00")
End Sub

I hope this will be a success.

Related Questions