I'm Currently working with a payroll system with daily time record.. I'm having troubles with their time records, what i did is this, i created 6 textboxes on the form the 1st textbox is for the AM IN 2nd is for the Lunch OUT the 3rd Is for the total hours worked for the half day, and the same for the 4th to 6th textboxes. I actually get the difference of 2nd and 1st textboxes and show the result at 3rd textbox and same for the 4th-6th textboxes using this code that I also get in this site
Dim TimeA As Date
Dim TimeB As Date
Dim hh As Integer
Dim mm As Integer
Dim ss As Integer
If Not Date.TryParse(TextBox1.Text, TimeA) Then
' Not a date
End If
If Not Date.TryParse(TextBox2.Text, TimeB) Then
' Not a date
End If
' Subtract (= time <strong class="highlight">between</strong>)
hh = TimeB.Subtract(TimeA).Hours
mm = TimeB.Subtract(TimeA).Minutes
ss = TimeB.Subtract(TimeA).Seconds
TextBox3.Text = hh.ToString.PadLeft(2, CChar("0")) & ":" & mm.ToString.PadLeft(2, CChar("0"))
If Not Date.TryParse(TextBox4.Text, TimeA) Then
' Not a date
End If
If Not Date.TryParse(TextBox5.Text, TimeB) Then
' Not a date
End If
' Subtract (= time <strong class="highlight">between</strong>)
hh = TimeB.Subtract(TimeA).Hours
mm = TimeB.Subtract(TimeA).Minutes
ss = TimeB.Subtract(TimeA).Seconds
TextBox6.Text = hh.ToString.PadLeft(2, CChar("0")) & ":" & mm.ToString.PadLeft(2, CChar("0"))
but i really didn't understand it so right now I don't know how to add the value of textbox3 and textbox6 so I could get the total hours worked of the employee.. pls teach me! i really want to learn vb and I would tell it right now I'm a bit slow so I need a lot of your patience, thanks a lot.