Time span - negative value

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)

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!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories