I am trying to create an up timer in the format of HH:MM:SS. I know how to do this in vb.net. I tried to use the same method for vb6 but it doesn't have a variable Date.
This is how to do it in vb.net, does someone know how to do it in vb6?
Code:Public Class Form1 Inherits System.Windows.Forms.Form Dim startTime As New Date Dim elapsedTime As TimeSpan ' Windows Form Designer generated code goes here Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If Timer1.Enabled Then Timer1.Enabled = False Else startTime = Now Timer1.Enabled = True End If End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick elapsedTime = New TimeSpan(Now.Ticks - startTime.Ticks) TextBox1.Text = elapsedTime.ToString.Substring(0, 8) End Sub End Class




Reply With Quote