Private Sub Form_Load()
Const NUM_VALUES = 10000
Dim i As Integer
Dim start_time As Single
Dim stop_time As Single
Dim values(1 To NUM_VALUES) As Integer
Screen.MousePointer = vbHourglass
' Before the form is visible.
start_time = Timer
For i = 1 To NUM_VALUES
List1.AddItem Format$(Rnd * 30000, "00000")
Next i
stop_time = Timer
lblList1.Caption = Format$(stop_time - start_time, _
"0.00") & " seconds"
start_time = Timer
For i = 1 To NUM_VALUES
List2.AddItem Format$(Rnd * 30000, "00000")
Next i
stop_time = Timer
lblList2.Caption = Format$(stop_time - start_time, _
"0.00") & " seconds"
start_time = Timer
For i = 1 To NUM_VALUES
values(i) = Rnd * 30000
Next i
Quicksort values, 1, 10000
For i = 1 To NUM_VALUES
List3.AddItem Format$(values(i), "00000")
Next i
stop_time = Timer
lblList3.Caption = Format$(stop_time - start_time, _
"0.00") & " seconds"
' Show the form.
Me.Show
DoEvents
start_time = Timer
For i = 1 To NUM_VALUES
List4.AddItem Format$(Rnd * 30000, "00000")
Next i
DoEvents
stop_time = Timer
lblList4.Caption = Format$(stop_time - start_time, _
"0.00") & " seconds"
DoEvents
start_time = Timer
For i = 1 To NUM_VALUES
List5.AddItem Format$(Rnd * 30000, "00000")
Next i
DoEvents
stop_time = Timer
lblList5.Caption = Format$(stop_time - start_time, _
"0.00") & " seconds"
DoEvents
start_time = Timer
For i = 1 To NUM_VALUES
values(i) = Rnd * 30000
Next i
Quicksort values, 1, 10000
For i = 1 To NUM_VALUES
List6.AddItem Format$(values(i), "00000")
Next i
DoEvents
stop_time = Timer
lblList6.Caption = Format$(stop_time - start_time, _
"0.00") & " seconds"
DoEvents
start_time = Timer
List7.Visible = False
For i = 1 To NUM_VALUES
List7.AddItem Format$(Rnd * 30000, "00000")
Next i
List7.Visible = True
DoEvents
stop_time = Timer
lblList7.Caption = Format$(stop_time - start_time, _
"0.00") & " seconds"
Screen.MousePointer = vbDefault
End Sub
|