home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Power Pack / Visual_Basic4_Power_Pack.bin / vb4files / t2win_32 / _array.frm (.txt) next >
Encoding:
Visual Basic Form  |  1996-11-20  |  23.0 KB  |  696 lines

  1. VERSION 4.00
  2. Begin VB.Form frmArray 
  3.    BorderStyle     =   4  'Fixed ToolWindow
  4.    Caption         =   "Array"
  5.    ClientHeight    =   4170
  6.    ClientLeft      =   1890
  7.    ClientTop       =   3270
  8.    ClientWidth     =   6690
  9.    Height          =   4575
  10.    Left            =   1830
  11.    MaxButton       =   0   'False
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   4170
  14.    ScaleWidth      =   6690
  15.    ShowInTaskbar   =   0   'False
  16.    Top             =   2925
  17.    Width           =   6810
  18.    Begin VB.ListBox List2 
  19.       Height          =   2010
  20.       Left            =   3510
  21.       TabIndex        =   2
  22.       Top             =   2070
  23.       Width           =   3075
  24.    End
  25.    Begin VB.ListBox List1 
  26.       Height          =   2010
  27.       Left            =   90
  28.       TabIndex        =   1
  29.       Top             =   2070
  30.       Width           =   3075
  31.    End
  32.    Begin Threed.SSPanel SSPanel1 
  33.       Align           =   1  'Align Top
  34.       Height          =   480
  35.       Left            =   0
  36.       TabIndex        =   3
  37.       Top             =   0
  38.       Width           =   6690
  39.       _Version        =   65536
  40.       _ExtentX        =   11800
  41.       _ExtentY        =   847
  42.       _StockProps     =   15
  43.       ForeColor       =   -2147483640
  44.       BackColor       =   12632256
  45.       Begin VB.ComboBox cmb_Function 
  46.          Height          =   315
  47.          Left            =   1365
  48.          TabIndex        =   4
  49.          Top             =   90
  50.          Width           =   3945
  51.       End
  52.       Begin Threed.SSCommand cmdNP 
  53.          Height          =   300
  54.          Index           =   1
  55.          Left            =   6300
  56.          TabIndex        =   8
  57.          Top             =   90
  58.          Width           =   255
  59.          _Version        =   65536
  60.          _ExtentX        =   450
  61.          _ExtentY        =   529
  62.          _StockProps     =   78
  63.          Caption         =   ">"
  64.          BevelWidth      =   1
  65.          Font3D          =   3
  66.          RoundedCorners  =   0   'False
  67.          Outline         =   0   'False
  68.       End
  69.       Begin Threed.SSCommand cmdNP 
  70.          Height          =   300
  71.          Index           =   0
  72.          Left            =   5460
  73.          TabIndex        =   7
  74.          Top             =   90
  75.          Width           =   255
  76.          _Version        =   65536
  77.          _ExtentX        =   450
  78.          _ExtentY        =   529
  79.          _StockProps     =   78
  80.          Caption         =   "<"
  81.          BevelWidth      =   1
  82.          Font3D          =   3
  83.          RoundedCorners  =   0   'False
  84.          Outline         =   0   'False
  85.       End
  86.       Begin VB.Label Label2 
  87.          Caption         =   "&Select a function"
  88.          Height          =   255
  89.          Left            =   90
  90.          TabIndex        =   6
  91.          Top             =   120
  92.          Width           =   1275
  93.       End
  94.       Begin Threed.SSCommand SSCommand1 
  95.          Default         =   -1  'True
  96.          Height          =   300
  97.          Left            =   5775
  98.          TabIndex        =   5
  99.          Top             =   90
  100.          Width           =   465
  101.          _Version        =   65536
  102.          _ExtentX        =   820
  103.          _ExtentY        =   529
  104.          _StockProps     =   78
  105.          Caption         =   "&Go"
  106.          BevelWidth      =   1
  107.          RoundedCorners  =   0   'False
  108.          Outline         =   0   'False
  109.       End
  110.    End
  111.    Begin VB.Label lbl_Result 
  112.       Appearance      =   0  'Flat
  113.       BackColor       =   &H00C0C0C0&
  114.       ForeColor       =   &H80000008&
  115.       Height          =   1275
  116.       Left            =   105
  117.       TabIndex        =   0
  118.       Top             =   630
  119.       Width           =   6495
  120.    End
  121. Attribute VB_Name = "frmArray"
  122. Attribute VB_Creatable = False
  123. Attribute VB_Exposed = False
  124. Option Explicit
  125. Option Base 1
  126. Private Const Iteration = 250
  127. Private Const arrSize = 10
  128. Dim IsLoaded         As Integer
  129. Dim TimerStartOk     As Integer
  130. Dim TimerCloseOk     As Integer
  131. Dim TimerHandle      As Integer
  132. Dim TimerValue       As Long
  133. Private Sub TestAdd()
  134.    Dim intResult        As Integer
  135.    Dim strDisplay       As String
  136.    Dim intLB            As Integer
  137.    Dim intUB            As Integer
  138.    Dim intTotalElement  As Integer
  139.    Dim i                As Integer
  140.    intResult = False
  141.    strDisplay = ""
  142.    ReDim array(arrSize) As Integer
  143.    Randomize Timer
  144.    intLB = LBound(array)
  145.    intUB = UBound(array)
  146.    intTotalElement = intUB - intLB + 1
  147.       
  148.    For i = intLB To intUB
  149.       array(i) = RandI * Rnd(1)
  150.       List1.AddItem "" & array(i)
  151.    Next i
  152.    intResult = cAddI(array(), 10)
  153.    For i = intLB To intUB
  154.       List2.AddItem "" & array(i)
  155.    Next i
  156.    strDisplay = strDisplay & "Add 10 to element " & intLB & " of an integer array is : " & array(intLB) & vbCrLf & vbCrLf
  157.    strDisplay = strDisplay & "Add 10 to element " & intUB & " of an integer array is : " & array(intUB)
  158.    lbl_Result = strDisplay
  159.    'time the function
  160.    TimerHandle = cTimerOpen()
  161.    TimerStartOk = cTimerStart(TimerHandle)
  162.    For i = 1 To Iteration
  163.       intResult = cAddI(array(), 1)
  164.    Next i
  165.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  166.    TimerCloseOk = cTimerClose(TimerHandle)
  167. End Sub
  168. Private Sub cmb_Function_Click()
  169.    If (IsLoaded = False) Then Exit Sub
  170.    Call cDisableFI(mdiT2W.Picture1)
  171.    List1.Visible = True
  172.    List2.Visible = True
  173.    List1.Clear
  174.    List2.Clear
  175.    lbl_Result = ""
  176.    DoEvents
  177.    Select Case cmb_Function.ListIndex
  178.       Case 0
  179.          Call TestAdd
  180.       Case 1
  181.          List2.Visible = False
  182.          Call TestCount
  183.       Case 2
  184.          List2.Visible = False
  185.          Call TestDeviation
  186.       Case 3
  187.          Call TestFill
  188.       Case 4
  189.          Call TestFillIncr
  190.       Case 5
  191.          Call TestMax
  192.       Case 6
  193.          List2.Visible = False
  194.          Call TestMean
  195.       Case 7
  196.          Call TestMin
  197.       Case 8
  198.          Call TestReverseSort
  199.       Case 9
  200.          Call TestSearch
  201.       Case 10
  202.          Call TestSet
  203.       Case 11
  204.          Call TestSort
  205.       Case 12
  206.          List2.Visible = False
  207.          Call TestSum
  208.       Case 13
  209.          Call TestArrayOnDisk
  210.    End Select
  211.    DoEvents
  212.    Call cEnableFI(mdiT2W.Picture1)
  213. End Sub
  214. Private Sub cmdNP_Click(Index As Integer)
  215.    Call sub_NextPrev(cmb_Function, Index)
  216. End Sub
  217. Private Sub Form_Activate()
  218.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  219. End Sub
  220. Private Sub Form_Load()
  221.    IsLoaded = False
  222.    Show
  223.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_array.t2w")
  224.    IsLoaded = True
  225. End Sub
  226. Private Sub TestDeviation()
  227.    Dim dblResult        As Double
  228.    Dim strDisplay       As String
  229.    Dim intLB            As Integer
  230.    Dim intUB            As Integer
  231.    Dim intTotalElement  As Integer
  232.    Dim i                As Integer
  233.    Dim dblMean          As Double
  234.    Dim dblDeviation     As Double
  235.    dblResult = 0
  236.    strDisplay = ""
  237.    dblMean = 0
  238.    dblDeviation = 0
  239.    ReDim array(arrSize) As Integer
  240.    Randomize Timer
  241.    intLB = LBound(array)
  242.    intUB = UBound(array)
  243.    intTotalElement = intUB - intLB + 1
  244.       
  245.    For i = intLB To intUB
  246.       array(i) = Int(RandI * Rnd(1))
  247.       dblMean = dblMean + array(i)
  248.       List1.AddItem "" & array(i)
  249.    Next i
  250.    dblMean = dblMean / (intTotalElement)
  251.    For i = intLB To intUB
  252.       dblDeviation = dblDeviation + ((array(i) - dblMean) * (array(i) - dblMean))
  253.    Next i
  254.    dblDeviation = (Sqr(dblDeviation) / (intTotalElement))
  255.    dblResult = cDeviationI(array())
  256.    strDisplay = "The Deviation of a integer array of " & (intTotalElement) & " elements is " & vbCrLf & vbCrLf & dblResult & " (" & dblDeviation & ")"
  257.    lbl_Result = strDisplay
  258.    'time the function
  259.    TimerHandle = cTimerOpen()
  260.    TimerStartOk = cTimerStart(TimerHandle)
  261.    For i = 1 To Iteration
  262.       dblResult = cDeviationI(array())
  263.    Next i
  264.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  265.    TimerCloseOk = cTimerClose(TimerHandle)
  266. End Sub
  267. Private Sub TestFill()
  268.    Dim intResult        As Integer
  269.    Dim strDisplay       As String
  270.    Dim intLB            As Integer
  271.    Dim intUB            As Integer
  272.    Dim intTotalElement  As Integer
  273.    Dim i                As Integer
  274.    intResult = False
  275.    strDisplay = ""
  276.    ReDim array(arrSize) As Integer
  277.    Randomize Timer
  278.    intLB = LBound(array)
  279.    intUB = UBound(array)
  280.    intTotalElement = intUB - intLB + 1
  281.       
  282.    For i = intLB To intUB
  283.       array(i) = RandI * Rnd(1)
  284.       List1.AddItem "" & array(i)
  285.    Next i
  286.    intResult = cFillI(array(), 5)
  287.    For i = intLB To intUB
  288.       List2.AddItem "" & array(i)
  289.    Next i
  290.    strDisplay = strDisplay & "Fill 1 to element " & intLB & " of an integer array is : " & array(intLB) & vbCrLf & vbCrLf
  291.    strDisplay = strDisplay & "Fill 1 to element " & intUB & " of an integer array is : " & array(intUB)
  292.    lbl_Result = strDisplay
  293.    'time the function
  294.    TimerHandle = cTimerOpen()
  295.    TimerStartOk = cTimerStart(TimerHandle)
  296.    For i = 1 To Iteration
  297.       intResult = cFillI(array(), 1)
  298.    Next i
  299.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  300.    TimerCloseOk = cTimerClose(TimerHandle)
  301. End Sub
  302. Private Sub TestFillIncr()
  303.    Dim intResult        As Integer
  304.    Dim strDisplay       As String
  305.    Dim intLB            As Integer
  306.    Dim intUB            As Integer
  307.    Dim intTotalElement  As Integer
  308.    Dim i                As Integer
  309.    intResult = False
  310.    strDisplay = ""
  311.    ReDim array(arrSize) As Integer
  312.    Randomize Timer
  313.    intLB = LBound(array)
  314.    intUB = UBound(array)
  315.    intTotalElement = intUB - intLB + 1
  316.       
  317.    For i = intLB To intUB
  318.       array(i) = RandI * Rnd(1)
  319.       List1.AddItem "" & array(i)
  320.    Next i
  321.    intResult = cFillIncrI(array(), -2, 3)
  322.    For i = intLB To intUB
  323.       List2.AddItem "" & array(i)
  324.    Next i
  325.    strDisplay = strDisplay & "Fill -2 by increment 3 to element " & intLB & " of an integer array is : " & array(intLB) & vbCrLf & vbCrLf
  326.    strDisplay = strDisplay & "Fill -2 by increment 3 to element " & intUB & " of an integer array is : " & array(intUB)
  327.    lbl_Result = strDisplay
  328.    'time the function
  329.    TimerHandle = cTimerOpen()
  330.    TimerStartOk = cTimerStart(TimerHandle)
  331.    For i = 1 To Iteration
  332.       intResult = cFillIncrI(array(), -2, 3)
  333.    Next i
  334.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  335.    TimerCloseOk = cTimerClose(TimerHandle)
  336. End Sub
  337. Private Sub TestMax()
  338.    Dim intResult        As Integer
  339.    Dim strDisplay       As String
  340.    Dim intLB            As Integer
  341.    Dim intUB            As Integer
  342.    Dim intTotalElement  As Integer
  343.    Dim i                As Integer
  344.    intResult = False
  345.    strDisplay = ""
  346.    ReDim array(arrSize) As Integer
  347.    Randomize Timer
  348.    intLB = LBound(array)
  349.    intUB = UBound(array)
  350.    intTotalElement = intUB - intLB + 1
  351.       
  352.    For i = intLB To intUB
  353.       array(i) = RandI * Rnd(1)
  354.       List1.AddItem "" & array(i)
  355.    Next i
  356.    intResult = cSortI(array())
  357.    For i = intLB To intUB
  358.       List2.AddItem "" & array(i)
  359.    Next i
  360.    intResult = cMaxI(array())
  361.    strDisplay = strDisplay & "The Max of this integer array is : " & intResult
  362.    lbl_Result = strDisplay
  363.    'time the function
  364.    TimerHandle = cTimerOpen()
  365.    TimerStartOk = cTimerStart(TimerHandle)
  366.    For i = 1 To Iteration
  367.       intResult = cMaxI(array())
  368.    Next i
  369.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  370.    TimerCloseOk = cTimerClose(TimerHandle)
  371. End Sub
  372. Private Sub TestMin()
  373.    Dim intResult        As Integer
  374.    Dim strDisplay       As String
  375.    Dim intLB            As Integer
  376.    Dim intUB            As Integer
  377.    Dim intTotalElement  As Integer
  378.    Dim i                As Integer
  379.    intResult = False
  380.    strDisplay = ""
  381.    ReDim array(arrSize) As Integer
  382.    Randomize Timer
  383.    intLB = LBound(array)
  384.    intUB = UBound(array)
  385.    intTotalElement = intUB - intLB + 1
  386.       
  387.    For i = intLB To intUB
  388.       array(i) = RandI * Rnd(1)
  389.       List1.AddItem "" & array(i)
  390.    Next i
  391.    intResult = cSortI(array())
  392.    For i = intLB To intUB
  393.       List2.AddItem "" & array(i)
  394.    Next i
  395.    intResult = cMinI(array())
  396.    strDisplay = strDisplay & "The Min of this integer array is : " & intResult
  397.    lbl_Result = strDisplay
  398.    'time the function
  399.    TimerHandle = cTimerOpen()
  400.    TimerStartOk = cTimerStart(TimerHandle)
  401.    For i = 1 To Iteration
  402.       intResult = cMinI(array())
  403.    Next i
  404.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  405.    TimerCloseOk = cTimerClose(TimerHandle)
  406. End Sub
  407. Private Sub TestMean()
  408.    Dim dblResult        As Double
  409.    Dim strDisplay       As String
  410.    Dim intLB            As Integer
  411.    Dim intUB            As Integer
  412.    Dim intTotalElement  As Integer
  413.    Dim i                As Integer
  414.    Dim dblMean          As Double
  415.    dblResult = 0
  416.    strDisplay = ""
  417.    dblMean = 0
  418.    dblMean = 0
  419.    ReDim array(arrSize) As Integer
  420.    Randomize Timer
  421.    intLB = LBound(array)
  422.    intUB = UBound(array)
  423.    intTotalElement = intUB - intLB + 1
  424.       
  425.    For i = intLB To intUB
  426.       array(i) = Int(RandI * Rnd(1))
  427.       dblMean = dblMean + array(i)
  428.       List1.AddItem "" & array(i)
  429.    Next i
  430.    dblMean = dblMean / (intTotalElement)
  431.    dblResult = cMeanI(array())
  432.    strDisplay = "The Mean of this integer array of " & (intTotalElement) & " elements is " & vbCrLf & vbCrLf & dblResult & " (" & dblMean & ")"
  433.    lbl_Result = strDisplay
  434.    'time the function
  435.    TimerHandle = cTimerOpen()
  436.    TimerStartOk = cTimerStart(TimerHandle)
  437.    For i = 1 To Iteration
  438.       dblResult = cMeanI(array())
  439.    Next i
  440.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  441.    TimerCloseOk = cTimerClose(TimerHandle)
  442. End Sub
  443. Private Sub TestReverseSort()
  444.    Dim intResult        As Integer
  445.    Dim strDisplay       As String
  446.    Dim intLB            As Integer
  447.    Dim intUB            As Integer
  448.    Dim intTotalElement  As Integer
  449.    Dim i                As Integer
  450.    intResult = False
  451.    strDisplay = ""
  452.    ReDim array(arrSize) As Integer
  453.    Randomize Timer
  454.    intLB = LBound(array)
  455.    intUB = UBound(array)
  456.    intTotalElement = intUB - intLB + 1
  457.       
  458.    For i = intLB To intUB
  459.       array(i) = RandI * Rnd(1)
  460.       List1.AddItem "" & array(i)
  461.    Next i
  462.    intResult = cReverseSortI(array())
  463.    For i = intLB To intUB
  464.       List2.AddItem "" & array(i)
  465.    Next i
  466.    lbl_Result = strDisplay
  467.    'time the function
  468.    TimerHandle = cTimerOpen()
  469.    TimerStartOk = cTimerStart(TimerHandle)
  470.    For i = 1 To Iteration
  471.       intResult = cReverseSortI(array())
  472.    Next i
  473.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  474.    TimerCloseOk = cTimerClose(TimerHandle)
  475. End Sub
  476. Private Sub TestSet()
  477.    Dim intResult        As Integer
  478.    Dim strDisplay       As String
  479.    Dim intLB            As Integer
  480.    Dim intUB            As Integer
  481.    Dim intTotalElement  As Integer
  482.    Dim i                As Integer
  483.    intResult = False
  484.    strDisplay = ""
  485.    ReDim array(arrSize) As Integer
  486.    Randomize Timer
  487.    intLB = LBound(array)
  488.    intUB = UBound(array)
  489.    intTotalElement = intUB - intLB + 1
  490.       
  491.    For i = intLB To intUB
  492.       array(i) = RandI * Rnd(1)
  493.       List1.AddItem "" & array(i)
  494.    Next i
  495.    intResult = cSetI(array(), 1024)
  496.    For i = intLB To intUB
  497.       List2.AddItem "" & array(i)
  498.    Next i
  499.    strDisplay = strDisplay & "Set 1024 to element " & intLB & " of an integer array is : " & array(intLB) & vbCrLf & vbCrLf
  500.    strDisplay = strDisplay & "Set 1024 to element " & intUB & " of an integer array is : " & array(intUB)
  501.    lbl_Result = strDisplay
  502.    'time the function
  503.    TimerHandle = cTimerOpen()
  504.    TimerStartOk = cTimerStart(TimerHandle)
  505.    For i = 1 To Iteration
  506.       intResult = cSetI(array(), 1)
  507.    Next i
  508.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  509.    TimerCloseOk = cTimerClose(TimerHandle)
  510. End Sub
  511. Private Sub TestSort()
  512.    Dim intResult        As Integer
  513.    Dim strDisplay       As String
  514.    Dim intLB            As Integer
  515.    Dim intUB            As Integer
  516.    Dim intTotalElement  As Integer
  517.    Dim i                As Integer
  518.    intResult = False
  519.    strDisplay = ""
  520.    ReDim array(arrSize) As Integer
  521.    Randomize Timer
  522.    intLB = LBound(array)
  523.    intUB = UBound(array)
  524.    intTotalElement = intUB - intLB + 1
  525.       
  526.    For i = intLB To intUB
  527.       array(i) = RandI * Rnd(1)
  528.       List1.AddItem "" & array(i)
  529.    Next i
  530.    intResult = cSortI(array())
  531.    For i = intLB To intUB
  532.       List2.AddItem "" & array(i)
  533.    Next i
  534.    lbl_Result = strDisplay
  535.    'time the function
  536.    TimerHandle = cTimerOpen()
  537.    TimerStartOk = cTimerStart(TimerHandle)
  538.    For i = 1 To Iteration
  539.       intResult = cSortI(array())
  540.    Next i
  541.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  542.    TimerCloseOk = cTimerClose(TimerHandle)
  543. End Sub
  544. Private Sub TestSum()
  545.    Dim dblResult        As Double
  546.    Dim strDisplay       As String
  547.    Dim intLB            As Integer
  548.    Dim intUB            As Integer
  549.    Dim intTotalElement  As Integer
  550.    Dim i                As Integer
  551.    Dim dblSum           As Double
  552.    dblResult = 0
  553.    strDisplay = ""
  554.    dblSum = 0
  555.    dblSum = 0
  556.    ReDim array(arrSize) As Integer
  557.    Randomize Timer
  558.    intLB = LBound(array)
  559.    intUB = UBound(array)
  560.    intTotalElement = intUB - intLB + 1
  561.       
  562.    For i = intLB To intUB
  563.       array(i) = Int(RandI * Rnd(1))
  564.       dblSum = dblSum + array(i)
  565.       List1.AddItem "" & array(i)
  566.    Next i
  567.    dblResult = cSumI(array())
  568.    strDisplay = "The Sum of this integer array of " & (intTotalElement) & " elements is " & vbCrLf & vbCrLf & dblResult & " (" & dblSum & ")"
  569.    lbl_Result = strDisplay
  570.    'time the function
  571.    TimerHandle = cTimerOpen()
  572.    TimerStartOk = cTimerStart(TimerHandle)
  573.    For i = 1 To Iteration
  574.       dblResult = cSumI(array())
  575.    Next i
  576.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  577.    TimerCloseOk = cTimerClose(TimerHandle)
  578. End Sub
  579. Private Sub TestCount()
  580.    Dim intResult        As Integer
  581.    Dim strDisplay       As String
  582.    Dim intLB            As Integer
  583.    Dim intUB            As Integer
  584.    Dim intTotalElement  As Integer
  585.    Dim i                As Integer
  586.    intResult = False
  587.    strDisplay = ""
  588.    ReDim array(arrSize) As Integer
  589.    Randomize Timer
  590.    intLB = LBound(array)
  591.    intUB = UBound(array)
  592.    intTotalElement = intUB - intLB + 1
  593.       
  594.    For i = intLB To intUB
  595.       array(i) = RandI * Rnd(1)
  596.       List1.AddItem "" & array(i)
  597.    Next i
  598.    strDisplay = strDisplay & "Count '" & array(1) & "' is " & cCountI(array(), array(1)) & vbCrLf
  599.    strDisplay = strDisplay & "Count '" & array(3) & "' is " & cCountI(array(), array(3)) & vbCrLf
  600.    strDisplay = strDisplay & "Count '" & array(5) & "' is " & cCountI(array(), array(5)) & vbCrLf
  601.    strDisplay = strDisplay & "Count '" & array(7) & "' is " & cCountI(array(), array(7)) & vbCrLf
  602.    strDisplay = strDisplay & "Count '" & array(9) & "' is " & cCountI(array(), array(9)) & vbCrLf
  603.    strDisplay = strDisplay & "Count '" & -1234 & "' is " & cCountI(array(), -1234)
  604.    lbl_Result = strDisplay
  605.    'time the function
  606.    TimerHandle = cTimerOpen()
  607.    TimerStartOk = cTimerStart(TimerHandle)
  608.    For i = 1 To Iteration
  609.       intResult = cCountI(array(), array(intLB))
  610.    Next i
  611.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  612.    TimerCloseOk = cTimerClose(TimerHandle)
  613. End Sub
  614. Private Sub TestSearch()
  615.    Dim intResult        As Integer
  616.    Dim strDisplay       As String
  617.    Dim intLB            As Integer
  618.    Dim intUB            As Integer
  619.    Dim intTotalElement  As Integer
  620.    Dim i                As Integer
  621.    intResult = False
  622.    strDisplay = ""
  623.    ReDim array(arrSize) As Integer
  624.    Randomize Timer
  625.    intLB = LBound(array)
  626.    intUB = UBound(array)
  627.    intTotalElement = intUB - intLB + 1
  628.       
  629.    For i = intLB To intUB
  630.       array(i) = RandI * Rnd(1)
  631.       List1.AddItem "" & array(i)
  632.    Next i
  633.    strDisplay = strDisplay & "Search '" & array(1) & "' is " & cSearchI(array(), array(1)) & vbCrLf
  634.    strDisplay = strDisplay & "Search '" & array(3) & "' is " & cSearchI(array(), array(3)) & vbCrLf
  635.    strDisplay = strDisplay & "Search '" & array(5) & "' is " & cSearchI(array(), array(5)) & vbCrLf
  636.    strDisplay = strDisplay & "Search '" & array(7) & "' is " & cSearchI(array(), array(7)) & vbCrLf
  637.    strDisplay = strDisplay & "Search '" & array(9) & "' is " & cSearchI(array(), array(9)) & vbCrLf
  638.    strDisplay = strDisplay & "Search '" & -1234 & "' is " & cSearchI(array(), -1234)
  639.    lbl_Result = strDisplay
  640.    'time the function
  641.    TimerHandle = cTimerOpen()
  642.    TimerStartOk = cTimerStart(TimerHandle)
  643.    For i = 1 To Iteration
  644.       intResult = cSearchI(array(), array(intLB))
  645.    Next i
  646.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  647.    TimerCloseOk = cTimerClose(TimerHandle)
  648. End Sub
  649. Private Sub SSCommand1_Click()
  650.    Call cmb_Function_Click
  651. End Sub
  652. Private Sub TestArrayOnDisk()
  653.    Dim intResult        As Integer
  654.    Dim strDisplay       As String
  655.    Dim intLB            As Integer
  656.    Dim intUB            As Integer
  657.    Dim intTotalElement  As Integer
  658.    Dim i                As Integer
  659.    intResult = False
  660.    strDisplay = ""
  661.    ReDim array(arrSize) As Integer
  662.    Randomize Timer
  663.    intLB = LBound(array)
  664.    intUB = UBound(array)
  665.    intTotalElement = intUB - intLB + 1
  666.       
  667.    For i = intLB To intUB
  668.       array(i) = RandI * Rnd(1)
  669.       List1.AddItem "" & array(i)
  670.    Next i
  671.    intResult = cArrayOnDisk("c:\test.dat", array(), PUT_ARRAY_ON_DISK)
  672.    strDisplay = strDisplay & "Save this integer array on disk is '" & intResult & "'" & vbCrLf & vbCrLf
  673.    DoEvents
  674.    intResult = cSetI(array(), 0)
  675.    strDisplay = strDisplay & "Set all element of this integer to 0 array is '" & intResult & "'" & vbCrLf & vbCrLf
  676.    For i = intLB To intUB
  677.       List2.AddItem "" & array(i)
  678.    Next i
  679.    DoEvents
  680.    List2.Clear
  681.    intResult = cArrayOnDisk("c:\test.dat", array(), GET_ARRAY_ON_DISK)
  682.    strDisplay = strDisplay & "Load from disk to this integer array is '" & intResult & "'"
  683.    For i = intLB To intUB
  684.       List2.AddItem "" & array(i)
  685.    Next i
  686.    lbl_Result = strDisplay
  687.    'time the function
  688.    TimerHandle = cTimerOpen()
  689.    TimerStartOk = cTimerStart(TimerHandle)
  690.    For i = 1 To Iteration
  691.       intResult = cArrayOnDisk("c:\test.dat", array(), GET_ARRAY_ON_DISK)
  692.    Next i
  693.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  694.    TimerCloseOk = cTimerClose(TimerHandle)
  695. End Sub
  696.