home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / ch_code / ch16 / axstats / testform.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-07-08  |  6.0 KB  |  196 lines

  1. VERSION 5.00
  2. Object = "*\AAXStats.vbp"
  3. Begin VB.Form TestForm 
  4.    Caption         =   "Form1"
  5.    ClientHeight    =   3570
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   7095
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   3570
  11.    ScaleWidth      =   7095
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin VB.CommandButton Command6 
  14.       Caption         =   "Item Error"
  15.       BeginProperty Font 
  16.          Name            =   "Verdana"
  17.          Size            =   9.75
  18.          Charset         =   0
  19.          Weight          =   400
  20.          Underline       =   0   'False
  21.          Italic          =   0   'False
  22.          Strikethrough   =   0   'False
  23.       EndProperty
  24.       Height          =   495
  25.       Left            =   4920
  26.       TabIndex        =   6
  27.       Top             =   840
  28.       Width           =   2055
  29.    End
  30.    Begin VB.CommandButton Command5 
  31.       Caption         =   "Remove Error"
  32.       BeginProperty Font 
  33.          Name            =   "Verdana"
  34.          Size            =   9.75
  35.          Charset         =   0
  36.          Weight          =   400
  37.          Underline       =   0   'False
  38.          Italic          =   0   'False
  39.          Strikethrough   =   0   'False
  40.       EndProperty
  41.       Height          =   495
  42.       Left            =   4920
  43.       TabIndex        =   5
  44.       Top             =   240
  45.       Width           =   2055
  46.    End
  47.    Begin VB.CommandButton Command4 
  48.       Caption         =   "E X I T"
  49.       BeginProperty Font 
  50.          Name            =   "Verdana"
  51.          Size            =   9.75
  52.          Charset         =   0
  53.          Weight          =   400
  54.          Underline       =   0   'False
  55.          Italic          =   0   'False
  56.          Strikethrough   =   0   'False
  57.       EndProperty
  58.       Height          =   495
  59.       Left            =   4920
  60.       TabIndex        =   4
  61.       Top             =   2880
  62.       Width           =   2055
  63.    End
  64.    Begin AXStats.Stats Stats1 
  65.       Left            =   480
  66.       Top             =   2160
  67.       _ExtentX        =   1402
  68.       _ExtentY        =   1058
  69.    End
  70.    Begin VB.ListBox List1 
  71.       BeginProperty Font 
  72.          Name            =   "Verdana"
  73.          Size            =   9.75
  74.          Charset         =   0
  75.          Weight          =   400
  76.          Underline       =   0   'False
  77.          Italic          =   0   'False
  78.          Strikethrough   =   0   'False
  79.       EndProperty
  80.       Height          =   3180
  81.       Left            =   2400
  82.       Sorted          =   -1  'True
  83.       TabIndex        =   3
  84.       Top             =   240
  85.       Width           =   2415
  86.    End
  87.    Begin VB.CommandButton Command3 
  88.       Caption         =   "Show Statistics"
  89.       Enabled         =   0   'False
  90.       BeginProperty Font 
  91.          Name            =   "Verdana"
  92.          Size            =   9.75
  93.          Charset         =   0
  94.          Weight          =   400
  95.          Underline       =   0   'False
  96.          Italic          =   0   'False
  97.          Strikethrough   =   0   'False
  98.       EndProperty
  99.       Height          =   495
  100.       Left            =   120
  101.       TabIndex        =   2
  102.       Top             =   1440
  103.       Width           =   2055
  104.    End
  105.    Begin VB.CommandButton Command2 
  106.       Caption         =   "Display Data"
  107.       Enabled         =   0   'False
  108.       BeginProperty Font 
  109.          Name            =   "Verdana"
  110.          Size            =   9.75
  111.          Charset         =   0
  112.          Weight          =   400
  113.          Underline       =   0   'False
  114.          Italic          =   0   'False
  115.          Strikethrough   =   0   'False
  116.       EndProperty
  117.       Height          =   495
  118.       Left            =   120
  119.       TabIndex        =   1
  120.       Top             =   840
  121.       Width           =   2055
  122.    End
  123.    Begin VB.CommandButton Command1 
  124.       Caption         =   "Create Data Set"
  125.       BeginProperty Font 
  126.          Name            =   "Verdana"
  127.          Size            =   9.75
  128.          Charset         =   0
  129.          Weight          =   400
  130.          Underline       =   0   'False
  131.          Italic          =   0   'False
  132.          Strikethrough   =   0   'False
  133.       EndProperty
  134.       Height          =   495
  135.       Left            =   120
  136.       TabIndex        =   0
  137.       Top             =   240
  138.       Width           =   2055
  139.    End
  140. Attribute VB_Name = "TestForm"
  141. Attribute VB_GlobalNameSpace = False
  142. Attribute VB_Creatable = False
  143. Attribute VB_PredeclaredId = True
  144. Attribute VB_Exposed = False
  145. '  ******************************
  146. '  ******************************
  147. '  ** MASTERING VB6            **
  148. '  ** by Evangelos Petroutos   **
  149. '  ** SYBEX, 1998              **
  150. '  ******************************
  151. '  ******************************
  152. Private Sub Command1_Click()
  153.     List1.Clear
  154.     Stats1.Clear
  155.     For i = 1 To 100
  156.         Stats1.Add Rnd() * 1000
  157.     Next
  158.     Command2.Enabled = True
  159.     Command3.Enabled = True
  160. End Sub
  161. Private Sub Command2_Click()
  162. Dim i As Long
  163.     List1.Clear
  164.     For i = 1 To Stats1.Count
  165.         List1.AddItem Format(Stats1.Item(i), "000.000000")
  166.     Next
  167. End Sub
  168. Private Sub Command3_Click()
  169.     StatsMsg = "There are " & Stats1.Count & " points in the data set" & vbCrLf
  170.     StatsMsg = StatsMsg & "Their average is " & Stats1.Average & vbCrLf
  171.     StatsMsg = StatsMsg & "The smalleest value " & Stats1.Min & vbCrLf
  172.     StatsMsg = StatsMsg & "The largest value " & Stats1.Max
  173.     MsgBox StatsMsg
  174. End Sub
  175. Private Sub Command4_Click()
  176.     End
  177. End Sub
  178. Private Sub Command5_Click()
  179. On Error Resume Next
  180.     Stats1.Remove 9999
  181.     If Err.Number <> 0 Then
  182.         MsgBox "ERROR # " & Err.Number - vbObjectError & vbCrLf & _
  183.                Err.Description & vbCrLf & _
  184.                "In module " & Err.Source
  185.     End If
  186. End Sub
  187. Private Sub Command6_Click()
  188. On Error Resume Next
  189.     Stats1.Item 9999
  190.     If Err.Number <> 0 Then
  191.         MsgBox "ERROR # " & Err.Number - vbObjectError & vbCrLf & _
  192.                Err.Description & vbCrLf & _
  193.                "In module " & Err.Source
  194.     End If
  195. End Sub
  196.