Now Place:2uzhan.com » Calculate the computation time

Calculate the computation time

Visual Basic .NET @ September 13, 2007   Views:0

I would like to calculate the computation time for my program.
But it seems not function.
What's wrong with my code?

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Timer1.Enabled = True

*****my program


End Sub


That's not what the Timer class is for. A Timer is like an alarm clock, not a stopwatch. The Timer raises its Tick event every the Interval elapses, just like an alarm clock will set off its alarm every 12 or 24 hours. What you want is, oddly enough, a Stopwatch object:


Dim timer As Stopwatch = Stopwatch.StartNew()

'Do something here.


Thank you!
I get it.

© 2018 2uzhan.com Contact