April 2002
Intermediate to advanced
688 pages
19h 51m
English
Timer Property
Microsoft.VisualBasic.DateAndTime
Timer
Double representing the number of seconds that have elapsed since midnight
Returns the number of seconds since midnight
Timer is classified as a function in VB 6 and as a read-only property in VB.NET.
You can use the Timer property as an easy method of passing a seed number to the Randomize procedure, as follows:
Randomize Timer( )
The Timer property is ideal for measuring the time taken to execute a procedure or program statement, as the following snippet shows:
Dim sStartTime As Single
Dim i As Integer
sStartTime = Timer( )
For i = 1 To 100
Console.WriteLine("Hello")
Next i
MsgBox("Time Taken = " & Timer( ) - sStartTime & " Seconds")While the Timer property returns a Double in VB.NET, the VB 6 Timer function returns a Single.
Read now
Unlock full access