Home All Groups Group Topic Archive Search About

Simple question: How to find Elapsed time (in seconds)

Author
6 Mar 2006 7:13 PM
Bill Nguyen
I need to display elapsed time for a process in VB.NET in secods.
What's the routine to do this?
Thanks

Bill

Author
6 Mar 2006 9:15 PM
tommaso.gastaldi
How about something simple like:

        Dim StartTime As DateTime = Now

        'Any processing here ...

        ElapsedTime = Now.Subtract(StartTime).TotalSeconds
        Dim ElapsedTime As Double =
Now.Subtract(StartTime).TotalSeconds
        MsgBox("Elapsed seconds: " & ElapsedTime,
MsgBoxStyle.Information)

-tom

Bill Nguyen ha scritto:

Show quoteHide quote
> I need to display elapsed time for a process in VB.NET in secods.
> What's the routine to do this?
> Thanks
>
> Bill
Author
6 Mar 2006 11:02 PM
Bill Nguyen
Works great!
Thanks Tomaso!

Bill

<tommaso.gasta***@uniroma1.it> wrote in message
Show quoteHide quote
news:1141679714.714292.14890@j33g2000cwa.googlegroups.com...
> How about something simple like:
>
>        Dim StartTime As DateTime = Now
>
>        'Any processing here ...
>
>        ElapsedTime = Now.Subtract(StartTime).TotalSeconds
>        Dim ElapsedTime As Double =
> Now.Subtract(StartTime).TotalSeconds
>        MsgBox("Elapsed seconds: " & ElapsedTime,
> MsgBoxStyle.Information)
>
> -tom
>
> Bill Nguyen ha scritto:
>
>> I need to display elapsed time for a process in VB.NET in secods.
>> What's the routine to do this?
>> Thanks
>>
>> Bill
>
Author
7 Mar 2006 6:05 AM
Cor Ligthert [MVP]
Bill,

As addition you can as well use the environment.tickcount
or
The new stopwatch class 2.0
http://msdn2.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx

I hope this helps,

Cor


Show quoteHide quote
"Bill Nguyen" <billn_nospam_please@jaco.com> schreef in bericht
news:OYPdHIVQGHA.5116@TK2MSFTNGP10.phx.gbl...
>I need to display elapsed time for a process in VB.NET in secods.
> What's the routine to do this?
> Thanks
>
> Bill
>