VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "AXStats"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Dim DataCollection As New Collection

Public Function Item(index)
    If index < 0 Or index > DataCollection.Count Then
        Err.Raise vbError + 1, "StatClass", "Index out of bounds (" & index & ")"
    Else
        Item = DataCollection(index)
    End If
End Function

Public Function Clear()
On Error GoTo ClearError
    For i = DataCollection.Count To 1 Step -1
        DataCollection.Remove i
    Next
    Clear = True
    Exit Function
    
ClearError:
    Clear = False
End Function

Public Property Get Count()
    Count = DataCollection.Count
End Property

Public Function Add(dValue)
On Error GoTo AddError
    DataCollection.Add dValue
    Add = True
    Exit Function
AddError:
    Add = False
End Function

Public Function Remove(index)
    If (index) < 0 Or (index) > (DataCollection.Count) Then
        Err.Raise vbError + 2, "StatClass", "Invalid index specified (" & index & ")"
        Remove = False
    Else
        DataCollection.Remove index
        Remove = True
    End If
End Function

Public Property Get Average()
Dim dSum As Double
    For Each Itm In DataCollection
        dSum = dSum + Itm
    Next
    Average = dSum / DataCollection.Count
End Property

Public Property Get Min()
    Min = DataCollection(1)
    For Each Itm In DataCollection
        If Itm < Min Then Min = Itm
    Next
End Property

Public Property Get Max()
    Max = DataCollection(1)
    For Each Itm In DataCollection
        If Itm > Max Then Max = Itm
    Next
End Property

Private Sub UserControl_Resize()
    UserControl.Width = 800
    UserControl.Height = 600
    Label1.Width = UserControl.Width
    Label1.Height = UserControl.Height
End Sub

