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

Recommended Answers

All 5 Replies

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.

do..

ts=d1-d2

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..
thanks

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

        MsgBox(ts.ToString)

Don't forget to give reputation....

thanks you sir.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.