📄 clsplanlist.cls
字号:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "clsPlanList"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'列表
Option Explicit
Dim TPlans() As New clsPlan
Dim nCount As Integer
Const nMaxCount As Integer = 32000 '最大的个数
Public Property Get Count() As Integer
Count = nCount
End Property
Public Property Get Items(nIndex As Integer) As clsPlan
If nIndex >= 0 And nIndex < nCount Then
Set Items = TPlans(nIndex)
Else
Set Items = Nothing
End If
End Property
Public Property Set Items(nIndex As Integer, TPlan As clsPlan)
If nIndex >= 0 And nIndex < nCount Then
Set TPlans(nIndex) = TPlan
Else
' Set Items = Null
End If
End Property
'''''''''''''''''''''''''''''''''''''''''''''''
'增加一个FileMsg项目
Public Function Add(TPlan As clsPlan) As Integer
Set TPlans(nCount) = TPlan
nCount = nCount + 1
ReDim Preserve TPlans(nCount)
Add = nCount
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''
'移除一个项目,//NOTICE://删除原理:把最后一个item移到要删除的位置,而不是删除该项目,把所有该项目后面的项目前移
Public Function ReMove(nIndex As Integer)
Dim strTag As String, nSockIndex As Integer
nCount = nCount - 1
Set TPlans(nIndex) = TPlans(nCount) '把最后一个item移到要删除的位置
Set TPlans(nCount) = Nothing '释放空间
ReDim Preserve TPlans(nCount)
End Function
Private Sub Class_Initialize()
If nCount = 0 Then ReDim Preserve TPlans(0)
nCount = UBound(TPlans) '因为数组下标为0,所以 可以认为nCount -指向数组的最大值加1,也就是空出来 贮存将来的一个clsMessage 类
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -