locked
Time span RRS feed

  • Question

  • Hi,

    I need a help to calculate elapsed time (start time -end time).
    I used the following code in windows apps. it's Working perfectly.

    But, when i use the same in Pocket PC apps,getting some negative result.
    I've tested it in Pocket PC Emulator.(VS2003,.NET framework 1.1)

    Code:

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            ck = DateTime.Now
            Timer2.Enabled = True
    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
            Timer2.Enabled = False
            ck1 = DateTime.Now
            ck3 = ck1.Subtract(ck)
            Label5.Text = String.Format("{00:d2}:{01:d2}", ck3.Minutes, ck3.Seconds)
            Timer2.Enabled = True
    End Sub


    Where ck,ck1 are datetime variables.
    ck3 timespan variable.

    Can anyone advice me to solve this?

    Thank YOu!

    Sunday, February 5, 2006 4:08 PM

Answers