dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: how to calculate the processing time for some operation..

  1. #1
    Join Date
    Mar 2006
    Posts
    21

    how to calculate the processing time for some operation..

    Hye all,
    i want to calculate the proccessing time for 1 function.
    for example once user click a button, it will capture the current time until finish time to the some operation.
    for example:

    Private Sub btnTest_Click(..)
    <current start time>
    .....
    .....
    <current finish time>

    time take = <current start time> - <current finish time>

    End Sub

    thanks~~

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Dim StartTime As DateTime = DateTime.Now
    ' Perform operation
    Dim EndTime As DateTime = DateTime.Now
    Dim Elasped As TimeSpan = EndTime.Subtract(StartTime)
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Mar 2006
    Posts
    21
    Quote Originally Posted by Phil Weber
    Dim StartTime As DateTime = DateTime.Now
    ' Perform operation
    Dim EndTime As DateTime = DateTime.Now
    Dim Elasped As TimeSpan = EndTime.Subtract(StartTime)
    ok.. let say i want to put the Elasped to the text box..
    i cannot simply code : Me.txtTime.Text = Val(Elasped) because it wasnt string..
    can u help me how to do that? the output shud be in in seconds
    Last edited by izza_azhar; 03-24-2006 at 10:47 PM.

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Type:

    txtTime.Text = Elapsed. <- type the period

    A list of elements of the TimeSpan structure will appear and you can select the one(s) you want to display. If you want to show hours, minutes and seconds, you may simply use Elapsed.ToString.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  5. #5
    Join Date
    Mar 2006
    Posts
    21
    Quote Originally Posted by Phil Weber
    Type:

    txtTime.Text = Elapsed. <- type the period

    A list of elements of the TimeSpan structure will appear and you can select the one(s) you want to display. If you want to show hours, minutes and seconds, you may simply use Elapsed.ToString.
    got it.. thanks~

  6. #6
    Join Date
    Aug 2005
    Posts
    46
    koi assignment mili hai kiya ?

Similar Threads

  1. query tuning
    By dhaya in forum Database
    Replies: 11
    Last Post: 08-25-2003, 05:24 PM
  2. Replies: 1
    Last Post: 03-07-2002, 12:21 PM
  3. Replies: 0
    Last Post: 06-26-2001, 11:04 AM
  4. Subtracting Time
    By Bryan in forum VB Classic
    Replies: 1
    Last Post: 06-02-2000, 07:39 PM
  5. Re: search for time !!!Error!!!
    By kammy in forum VB Classic
    Replies: 0
    Last Post: 05-01-2000, 04:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center