hello,
do you look for something like that (?):
Public Class Form1
Dim DiffZeit As Date
Dim TSpan As TimeSpan
Private Sub BtnStart_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BtnStart.Click
Timer1.Enabled = True
DiffZeit = DateTime.Now
End Sub
Private Sub BtnStop_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BtnStop.Click
Timer1.Enabled = False
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
TSpan = DateTime.Now.Subtract(DiffZeit)
Label1.Text = TSpan.Days & ":" & TSpan.Hours & ":" & TSpan.Minutes &
":" & TSpan.Seconds
End Sub
End Class
greetings,
heike kersten
"av" <av@discussions.microsoft.com> schrieb im Newsbeitrag
news:C9**********************************@microsof t.com...
im having a hard time creating a timer in vb.net..
the program should run this way: the timer should only start when you
press
a button then stops when presing it again..
my problem is that, how to make an output that will sum up all of the time
spent..
could you please provide me a sample code?
your reply will be greatly appreciated
thanks