Hello, I'm new on the forum and also in VB.NET.
I'm having a problem with chrono program. I use the system time to start from 00:00:00.000, but when I run the program I've seen that it sometimes start negative?
Can someone help me?
This the code:
Please feel free to edit the code or give suggestions?
I'm having a problem with chrono program. I use the system time to start from 00:00:00.000, but when I run the program I've seen that it sometimes start negative?
Can someone help me?
This the code:
VB.NET:
Public Class Form1
Dim chrono As New DateTime
Dim effTijd As DateTime
Private Sub btn_start_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_start.Click
effTijd = DateTime.Now
Timer1.Start()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txt_honderden.Text = "000"
txt_seconden.Text = "00"
txt_minuten.Text = "00"
txt_uren.Text = "00"
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
chrono = DateTime.Now
txt_honderden.Text = chrono.Millisecond - effTijd.Millisecond
txt_seconden.Text = chrono.Second - effTijd.Second
txt_minuten.Text = chrono.Minute - effTijd.Minute
txt_uren.Text = chrono.Hour - effTijd.Hour
End Sub
Private Sub btn_stop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_stop.Click
Timer1.Stop()
txt_honderden.Text = "000"
txt_seconden.Text = "00"
txt_minuten.Text = "00"
txt_uren.Text = "00"
End Sub
End Class
Last edited by a moderator: