Add 80:00:00 with 10:00:00 with vb6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • samvb
    New Member
    • Oct 2006
    • 228

    Add 80:00:00 with 10:00:00 with vb6

    With vb6,

    how can i add the above time to return 90:00:00

    something like this:

    Time Calculator Online - online tool that allows adding time given in hh:mm:ss.ms (hour,minute,second,milisecond) as well as decimal time format. It could also work as time format converter.
  • Guido Geurs
    Recognized Expert Contributor
    • Oct 2009
    • 767

    #2
    Begin:
    Add to the form the textboxes with index=0
    Textboxes for : Operation(0) , Hours(0) , Min(0) , ...

    The best way is to go in 3 steps:

    1- Update display on clicking the Operation command (+, -, ..):
    Add textboxes with "Load" from the original ones (Operation(0) , Hours(0),...) with index= ubound + 1
    set the Top of the new textboxes in function of the index like:

    Code:
       Load Text1(Text1.UBound + 1)
       Text1(Text1.UBound).Top = Text1(Text1.UBound - 1).Top + 600
       Text1(Text1.UBound).Visible = True
    2- calculate in function of the Operation command.
    !!! calculate with the lowest unit (sec, milsec, ...)=
    If the lowest unit= sec. => set hours to sec, set min to sec,... make the operations for index (of one component like: TextboxHours) from Lbound to Ubound.

    Code:
    for i= textHours.lbound to textHours.ubound
       Select case Operation(i).caption
       case "+": Result= Result + (textHours(i)*3600) + (textMin(i)*60) +...
       case "-": Result=Result - ...
       end select
    next
    3- Adapt the display in function of the result=
    hours= int(result/3600)
    minutes = int((result - hours )/60)
    ...

    Comment

    Working...