'物件類別 Class ParentObj_SubCount
Public Class ParentObj_SubCount
Private _ParentObjName As String '父物件名稱
Private _Parentidx As Double '父物件ID
Private _ChildCount As Integer '共有多少子物件
Public aArrary(10) As Double'子物件的ID號碼
'Public aArrary() As Double = New Double() {} '子物件的ID號碼 (也可以先不指定)
Public Property ParentObjName() As String '父物件名稱
Get
Return _ParentObjName
End Get
Set(ByVal value As String)
_ParentObjName = value
End Set
End Property
Public Property Parentidx() As String '父物件ID
Get
Return _Parentidx
End Get
Set(ByVal value As String)
_Parentidx = value
End Set
End Property
Public Property ChildCount() As String '共有多少子物件
Get
Return _ChildCount
End Get
Set(ByVal value As String)
_ChildCount = value
End Set
End Property
End Class
'----------------------------------------------------------------------
程式內引用
'----------------------------------------------------------------------
Dim PosList As New List(Of ParentObj_SubCount)
Dim n As Integer
For n = 0 To 10
Dim Ps As New ParentObj_SubCount
Ps.Parentidx = n + 1
Ps.ParentObjName = "obj" & n.ToString
'ReDim Ps.aArrary(100) 此程式碼可重新指定 陣列大小
Ps.aArrary(0) = 1 '指定值
Ps.aArrary(1) = 2 '指定值
PosList.Add(Ps) '新增入陣列
Next
Debug.Print(PosList(0).aArrary(0))
Debug.Print(PosList(0).aArrary(1))
Debug.Print("--------------------")
Debug.Print(PosList(1).aArrary(1))
Debug.Print(PosList(1).aArrary(2))
沒有留言:
張貼留言