1.11M Members

getting difference of time and how to add results


pls help.. I have a to create a timecard calculator. it goes this way

txtbox1 is for their 1st in
txtbox2 is for their 1st out

textbox3 is for the difference of txtbox1 and textbox2

txtbox4 is for their 2st in
txtbox5 is for their 2st out

textbox6 is for the difference of txtbox4 and textbox5

textbox7 is for the sum of total hour and minutes of textbox3 and textbox6


declare two date type variables ..

Now make 1st with textbox1's value.
and 2nd with textbox2's value.

now declare a timespan variable and simply.



here ts is the timespan. in timespan you can get the total minutes....


thank you sir....I'll try this one


what i did is this

dim val1 as date
dim val2 as date
dim val1 as timespan
val1= textbox1.text
val2= textbox2.text
val3= val2-val1
textbox3.text= val3

but its doesn't work.. im sory Im a bit slow about
pls show me codes..

Dim d1 As DateTime
        Dim d2 As DateTime
        Dim ts As TimeSpan

        'Time format is 10:35:23. So in textbox you must type like this...
        d1 = DateTime.Parse("1/1/2012 " + Me.TextBox1.Text.Trim)
        d2 = DateTime.Parse("1/1/2012 " + Me.TextBox2.Text.Trim)
        ts = d2 - d1


Don't forget to give reputation....


thanks you sir.

Question Answered as of 2 Years Ago by kingsonprisonic
This question has already been solved: Start a new discussion instead
Start New Discussion
View similar articles that have also been tagged: