home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Programmer'…arterly (Limited Edition) / Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso / code / ch19code / textboxe.cls < prev    next >
Text File  |  1995-08-14  |  1KB  |  49 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "TextBoxes"
  6. Attribute VB_Creatable = True
  7. Attribute VB_Exposed = False
  8. ' TextBoxes Class
  9. '   A type-safe collection for text box controls.
  10. Option Explicit
  11.  
  12. ' Private collection contains the objects --
  13. ' Add, Item, Remove, and Count members control
  14. ' access to this collection.
  15. Private colTextBoxes As New Collection
  16.  
  17. ' Modified Add method -- verifies object type
  18. ' before adding an object to the collection.
  19. Sub Add(TextBox As Control, Optional Key, Optional Before, Optional After)
  20.     ' If the object is a text box, add it to
  21.     ' the collection.
  22.     If TypeName(TextBox) = "TextBox" Then
  23.         colTextBoxes.Add TextBox, Key, Before, After
  24.     ' Cause a type mismatch error.
  25.     Else
  26.         Error 13
  27.     End If
  28. End Sub
  29.  
  30. ' Standard Remove method.
  31. Sub Remove(Index)
  32.      colTextBoxes.Remove Index
  33. End Sub
  34.  
  35. ' Standard Item method.
  36. Function Item(Index) As Object
  37.     ' Use the Set statement to return an object
  38.     ' reference. Simple assignment would return
  39.     ' the default property for the object
  40.     Set Item = colTextBoxes.Item(Index)
  41. End Function
  42.  
  43. ' Standard Count property.
  44. Property Get Count() As Integer
  45.     Count = colTextBoxes.Count
  46. End Property
  47.  
  48.  
  49.