s c

s c

  • NA
  • 14
  • 0

get the number of hours between two textboxes

Jul 18 2008 6:52 PM
Hi all,
        This is my second post here, last time Alan was a STAR and solved it straight away - THANKS again if your reading :-)


I need some help again, this time to get the number of hours between two textboxes.
 
IE: i have two textboxes on a form .

LoggedIn.text
Loggedout.text

 What i want to do is calculate the number of hours difference between loggedin.text and loggedout.text.

 I can do this if i enter in loggedin.text: 07:00 am    and in LoggedOut.text 12:00 pm  - it will give me 5 hrs no problem but i need it for a timesheet and the user may start at 9pm and finish at 5am the following day and when i put these values in i get -hrs.

 I presume i need to add the date somehow to each value first (07/08/2008 9:00 pm)  and (08/08/2008 05:30 am) but how do i get the number of hours and minutes in the difference?

 Any help with code would be greatly appreciated. If you need any further info then please let me know.

BTW, i am using vb.net 2008 (vb not C#)

 Thanks in advance.

Answers (11)