给你个示例吧: 窗体代码: Private Sub Command1_Click() Dim obj1 As New Class1 Dim i As Integer, j As Integer Dim array1(10, 10) As Object
For i = 1 To 10 For j = 1 To 10 Set array1(i, j) = New Class1 array1(i, j).count = i * j Debug.Print array1(i, j).count Next Next End Sub类代码: Private i As IntegerPublic Property Let count(ByVal j As Integer) i = j End Property Public Property Get count() As Integer count = i End Property
窗体代码:
Private Sub Command1_Click()
Dim obj1 As New Class1
Dim i As Integer, j As Integer
Dim array1(10, 10) As Object
For i = 1 To 10
For j = 1 To 10
Set array1(i, j) = New Class1
array1(i, j).count = i * j
Debug.Print array1(i, j).count
Next
Next
End Sub类代码:
Private i As IntegerPublic Property Let count(ByVal j As Integer)
i = j
End Property
Public Property Get count() As Integer
count = i
End Property
结束。