home *** CD-ROM | disk | FTP | other *** search
Visual Basic class definition | 1998-12-19 | 1.7 KB | 67 lines |
- VERSION 1.0 CLASS
- BEGIN
- MultiUse = -1 'True
- END
- Attribute VB_Name = "clsProperties"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = True
- Attribute VB_PredeclaredId = False
- Attribute VB_Exposed = False
- Private Properties As New Collection
- Public Sub AddProperty(Name, ObjectName, Value, Object As Object)
- If Not ReturnProperty(CStr(ObjectName), CStr(Name)) Is Nothing Then Exit Sub
- Dim nProp As New clsProperty
- nProp.PName = Name
- nProp.PObjectName = ObjectName
- nProp.PValue = Value
- Set nProp.ObjectReferense = Object
- Properties.Add nProp
- End Sub
-
- Public Function ReturnProperty(ObjectName As String, PropertyName As String) As clsProperty
- Dim CP As clsProperty, I As Long
- For I = 1 To Count
- Set CP = Properties(I)
- If CP.PObjectName = ObjectName And CP.PName = PropertyName Then
- Set ReturnProperty = CP
- End If
- Next
- End Function
-
- Public Property Get Count() As Long
- Count = Properties.Count
- End Property
-
- Public Sub Clear()
- For I = 1 To Properties.Count
- Properties.Remove 1
- Next
- End Sub
-
- Public Sub DeleteProperty(ObjectName As String, PropertyName As String)
- Dim CP As clsProperty, I As Long
- For I = 1 To Count
- Set CP = Properties(I)
- If CP.PObjectName = ObjectName And CP.PName = PropertyName Then
- Properties.Remove I
- Exit Sub
- End If
- Next
- End Sub
-
- Public Function RetPropsbByPName(PropertyName As String) As Collection
- Set RetPropsbByPName = New Collection
- Dim CP As clsProperty, I As Long
- For I = 1 To Count
- Set CP = Properties(I)
- If CP.PName = PropertyName Then
- RetPropsbByPName.Add CP
- End If
- Next
- End Function
-
- Public Function ReturnPByIdx(Index As Long) As clsProperty
- On Error Resume Next
- Set ReturnPByIdx = Properties(Index)
- End Function
-