home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / ch_code / ch15 / axstat / testform.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-07-06  |  5.8 KB  |  186 lines

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