0
我有以下兩類我該如何解決
Public Class Square
Private _ParentForm As Form
Public Sub New(ByVal Parent As Form)
_ParentForm = Parent
End Sub
'Implementation omitted
End Class
Public Class Board
Private _ParentForm As Form
Public Sub New(ByVal Parent As Form)
_ParentForm = Parent
End Sub
Private _Squares As List(Of Square)
Public Property Squares() As List(Of Square)
Get
Return _Squares
End Get
Set(ByVal value As List(Of Square))
_Squares = value
End Set
End Property
End Class
此對象引用錯誤,當我使用followng代碼它給我對象引用不設置到對象錯誤
Dim b As New Board(Me)
Dim s As New Square(Me)
b.Squares.Add(s)
的一個實例是什麼發生在這裏
此語法不正確。它應該是'b.Squares =新的列表(廣場)' –