Results 1 to 4 of 4

Thread: [RESOLVED] change the start stop time depending on list1 value

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2010
    Posts
    30

    Resolved [RESOLVED] change the start stop time depending on list1 value

    iam doing a project auto datalogger.

    i have list1 ( auto /manual)

    i have start time text box
    and finish time test box

    and cmdstart and cmstop.
    my requirement is
    1) when i click cmdstart and if the list1=auto
    i want start time = time eg ( 8:45:01 am)
    finishtime= time+3 hours (11:45:01 am)
    and the cmdstop should occur at 11:45:01 am

    2) if list1=manual
    then only start time should be displayed
    and when cmdstop clicked it should display stop time.

    means if the list is auto start and finish time are of 3 hours diffrence.and if it is in manual mode finish time should be logged after clicking cmdstop.

    many thanks in advace

  2. #2
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431

    Re: change the start stop time depending on list1 value

    Most of your question isn't about math. Using VB6, the easiest way to get a timer is using the GetTickCount API call, which returns the number of milliseconds since the system was started.

    Code:
    StartTime = GetTickCount()
    ...
    EndTime = GetTickCount()
    To convert from milliseconds to hours/minutes/seconds, do the following:

    Code:
    'timeMS = input time in milliseconds
        timeMS = Val(InputBox("timeMS = ", , CStr(timeMS)))
        timeS = Int(timeMS / 1000)
        timeMin = Int(timeS / 60)
        timeH = Int(timeMin / 60)
        MsgBox "hours = " & timeH Mod 24 & ", minutes = " & timeMin Mod 60 & ", seconds = " & timeS Mod 60
    If you have coding questions, they should be in the appropriate coding forum. Any coder there should easily be able to understand this code. Depending on your system, you can add the time between EndTime and StartTime to the system time at StartTime, though that's another coding issue so I won't go into it.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2010
    Posts
    30

    Re: change the start stop time depending on list1 value

    hello
    Jemidia

    i want start time and stop time should be of 3 hours diffrence.and should be called based on list1 value.
    if its auto start time = time and finish time should be 3hours+starttime.

    regards
    raj

  4. #4
    Only Slightly Obsessive jemidiah's Avatar
    Join Date
    Apr 2002
    Posts
    2,431

    Re: change the start stop time depending on list1 value

    Please ask the above question in the appropriate programming forum. Point them to this thread for the number conversion. I won't help with a coding question that's, to be honest, this simple, where most of the "help" will be getting you to give enough detail to answer your question properly. Good luck.
    The time you enjoy wasting is not wasted time.
    Bertrand Russell

    <- Remember to rate posts you find helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width