For i = 1 To 100
  For j = 1 To 100
    Set Map(i, j) = New Class2
    Map(i, j) = "ABC"
    Map(i.j).xxx=xxx
Next j
Next i上面代码要实现的意思是很容易看出来的。但是vb不同意这样做。请问是什么原因,谢谢。

解决方案 »

  1.   

    给你个示例吧:
    窗体代码:
    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
      

  2.   

    Map(i, j) = "ABC"这句错误。还是定一个属性算了。
    结束。