home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 6 Unleashed…sional Reference Edition) / Visual_Basic_6_Unleashed_Professional_Reference_Edition_Sams_1999.iso / Source / CHAP35 / FRMTIMER.FRM (.txt) < prev   
Encoding:
Visual Basic Form  |  1997-06-22  |  2.8 KB  |  103 lines

  1. VERSION 5.00
  2. Begin VB.Form frmTimer 
  3.    Caption         =   "Code Timing Template"
  4.    ClientHeight    =   3570
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   5685
  8.    LinkTopic       =   "Form2"
  9.    ScaleHeight     =   3570
  10.    ScaleWidth      =   5685
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.CommandButton cmdTest 
  13.       Caption         =   "Run Test"
  14.       Height          =   495
  15.       Left            =   480
  16.       TabIndex        =   5
  17.       Top             =   3000
  18.       Width           =   2295
  19.    End
  20.    Begin VB.Frame Frame1 
  21.       Caption         =   "Code Test Options"
  22.       Height          =   1335
  23.       Left            =   240
  24.       TabIndex        =   0
  25.       Top             =   360
  26.       Width           =   4935
  27.       Begin VB.OptionButton Option2 
  28.          Caption         =   "Option2"
  29.          Height          =   255
  30.          Left            =   360
  31.          TabIndex        =   2
  32.          Top             =   720
  33.          Width           =   1455
  34.       End
  35.       Begin VB.OptionButton Option1 
  36.          Caption         =   "Option1"
  37.          Height          =   255
  38.          Left            =   360
  39.          TabIndex        =   1
  40.          Top             =   360
  41.          Width           =   1455
  42.       End
  43.    End
  44.    Begin VB.Label lblOpt2 
  45.       Height          =   255
  46.       Left            =   360
  47.       TabIndex        =   4
  48.       Top             =   2520
  49.       Width           =   4815
  50.    End
  51.    Begin VB.Label lblOpt1 
  52.       Height          =   255
  53.       Left            =   360
  54.       TabIndex        =   3
  55.       Top             =   1920
  56.       Width           =   4815
  57.    End
  58. Attribute VB_Name = "frmTimer"
  59. Attribute VB_GlobalNameSpace = False
  60. Attribute VB_Creatable = False
  61. Attribute VB_PredeclaredId = True
  62. Attribute VB_Exposed = False
  63. Private Sub cmdTest_Click()
  64. Dim Start, Finish, TotalTime
  65.     If Option1.Value = True Then
  66.         Start = Timer
  67.         
  68.         'Put the code you wish to time
  69.         'here!
  70.         
  71.         
  72.         'End of Code time test
  73.         Finish = Timer
  74.     Else
  75.         'Option 2 selected
  76.         Start = Timer
  77.         
  78.         'Put the code you wish to time
  79.         'here!
  80.         
  81.         
  82.         'End of Code time test
  83.         Finish = Timer
  84.         
  85.     End If
  86.     TotalTime = Finish - Start  ' Calculate total time.
  87.     '
  88.     'Set up display results
  89.     '
  90.     If Option1.Value = True Then
  91.         'Option 1
  92.         lblOpt1.Caption = "Total time to execute " & _
  93.                             Option1.Caption & ": " & _
  94.                             TotalTime
  95.     Else
  96.         'Option 2
  97.         lblOpt2.Caption = "Total time to execute " & _
  98.                             Option2.Caption & ": " & _
  99.                             TotalTime
  100.     End If
  101.         
  102. End Sub
  103.