home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.UserControl Stats
- ClientHeight = 795
- ClientLeft = 0
- ClientTop = 0
- ClientWidth = 945
- InvisibleAtRuntime= -1 'True
- ScaleHeight = 795
- ScaleWidth = 945
- Begin VB.Label Label1
- Alignment = 2 'Center
- BorderStyle = 1 'Fixed Single
- Caption = "AX Stats"
- BeginProperty Font
- Name = "Verdana"
- Size = 12
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 600
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 700
- End
- End
- Attribute VB_Name = "Stats"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = True
- ' ******************************
- ' ******************************
- ' ** MASTERING VB6 **
- ' ** by Evangelos Petroutos **
- ' ** SYBEX, 1998 **
- ' ******************************
- ' ******************************
- Dim DataCollection As New Collection
-
- Public Function Item(index As Long) As Double
- If index < 0 Or index > DataCollection.Count Then
- Err.Raise vbObjectError + 1, "AXStats", "Index out of bounds (" & index & ")"
- Else
- Item = DataCollection(index)
- End If
- End Function
-
- Public Function Clear() As Boolean
- 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() As Long
- Attribute Count.VB_MemberFlags = "400"
- Count = DataCollection.Count
- End Property
-
- Public Function Add(dValue As Double)
- On Error GoTo AddError
- DataCollection.Add dValue
- Add = True
- Exit Function
- AddError:
- Add = False
- End Function
-
- Public Function Remove(index As Long) As Boolean
- If (index) < 0 Or (index) > (DataCollection.Count) Then
- Err.Raise vbObjectError + 2, "AXStats", "Invalid index specified (" & index & ")"
- Remove = False
- Else
- DataCollection.Remove index
- Remove = True
- End If
- End Function
-
- Public Property Get Average() As Double
- Attribute Average.VB_MemberFlags = "400"
- Dim dSum As Double
- For Each Itm In DataCollection
- dSum = dSum + Itm
- Next
- Average = dSum / DataCollection.Count
- End Property
-
- Public Property Let Average(ByVal New_Average As Double)
- If Ambient.UserMode = False Then Err.Raise 387
- m_Average = New_Average
- PropertyChanged "Average"
- End Property
-
- Public Property Get Min() As Double
- Attribute Min.VB_MemberFlags = "400"
- Min = 1E+202
- For Each Itm In DataCollection
- If Itm < Min Then Min = Itm
- Next
- End Property
-
- Public Property Get Max() As Double
- Attribute Max.VB_MemberFlags = "400"
- Max = -1E+202
- For Each Itm In DataCollection
- If Itm > Max Then Max = Itm
- Next
- End Property
-
- Public Property Let Max(ByVal New_Max As Double)
- If Ambient.UserMode = False Then Err.Raise 387
- m_Max = New_Max
- PropertyChanged "Max"
- End Property
-
- Private Sub UserControl_Resize()
- UserControl.Width = 800
- UserControl.Height = 600
- Label1.Width = UserControl.Width
- Label1.Height = UserControl.Height
- End Sub
-