Good day all!
I am currently working on a little timer app where you click start button that will display the time of day when you start your work. Then the stop button will do the same but display the time when you finish your task. My msgbox for now displays a few infos including the difference(WorkTime) between the TimeStop and the TimeStart. What i am trying to do is I need to have the WorkTime to be rounded to the 15 mins. Lets say anything from 0mins to 15 mins will set Worktime to 15, 15 to 30 will set to 30 etc.. 2hours will be something like 120. here is my code :
Everything I have in my code is working so far. Anyone got any Idea how I can get my problem resolved??
I am currently working on a little timer app where you click start button that will display the time of day when you start your work. Then the stop button will do the same but display the time when you finish your task. My msgbox for now displays a few infos including the difference(WorkTime) between the TimeStop and the TimeStart. What i am trying to do is I need to have the WorkTime to be rounded to the 15 mins. Lets say anything from 0mins to 15 mins will set Worktime to 15, 15 to 30 will set to 30 etc.. 2hours will be something like 120. here is my code :
VB.NET:
Public Class Form1
Dim TimeStart As Date
Dim TimeStop As Date
Dim Section As String
Dim Conseiller As String
Dim Informations As String
Dim TotalTime As TimeSpan
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
btnStop.Enabled = False
btnSave.Enabled = False
End Sub
Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
'Set l'heure a laquelle on debute le travail
TimeStart = TimeOfDay
lblTimeStart.Text = TimeStart
btnStop.Enabled = True
btnStart.Enabled = False
End Sub
Private Sub btnStop_Click(sender As Object, e As EventArgs) Handles btnStop.Click
' Set l'heure a laquelle on termine le travail
TimeStop = TimeOfDay
lblTimeStop.Text = TimeStop
btnStop.Enabled = False
btnSave.Enabled = True
End Sub
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
Dim TotalTimeString As String
Section = cmbSection.SelectedItem
Conseiller = txtConseiller.Text
Informations = txtInformations.Text
TotalTime = TimeStop - TimeStart
TotalTimeString = TotalTime.ToString
MsgBox(Section & "," & Conseiller & "," & Informations & "," & TotalTimeString)
End Sub
End Class
Everything I have in my code is working so far. Anyone got any Idea how I can get my problem resolved??