VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "TextBoxes"
Attribute VB_Creatable = True
Attribute VB_Exposed = False
' TextBoxes Class
'   A type-safe collection for text box controls.
Option Explicit

' Private collection contains the objects --
' Add, Item, Remove, and Count members control
' access to this collection.
Private colTextBoxes As New Collection

' Modified Add method -- verifies object type
' before adding an object to the collection.
Sub Add(TextBox As Control, Optional Key, Optional Before, Optional After)
    ' If the object is a text box, add it to
    ' the collection.
    If TypeName(TextBox) = "TextBox" Then
        colTextBoxes.Add TextBox, Key, Before, After
    ' Cause a type mismatch error.
    Else
        Error 13
    End If
End Sub

' Standard Remove method.
Sub Remove(Index)
     colTextBoxes.Remove Index
End Sub

' Standard Item method.
Function Item(Index) As Object
    ' Use the Set statement to return an object
    ' reference. Simple assignment would return
    ' the default property for the object
    Set Item = colTextBoxes.Item(Index)
End Function

' Standard Count property.
Property Get Count() As Integer
    Count = colTextBoxes.Count
End Property


