我正在使用datagridview
向用户显示我的对象集合属性值。问题是我添加了一个子类或嵌套对象(不知道如何调用它),并且还希望显示该子类的属性。
示例:
Public Class Person
Public Property Name As String
Public Property Age As Integer
Public Property Gender As Gender
Public Property Adress As Adress
End Class
Public Enum Gender
Male
Female
End Enum
Public Class Adress
Public Property Street As String
Public Property City As String
Public Property Zipcode As String
End Class
要添加列,我不使用自动列选项,但我自己添加它们(我不想在dgv中显示所有属性)
我添加这样的列:
Dim NameColumn As New DataGridViewTextBoxColumn()
With NameColumn
.DataPropertyName = "Name"
.Name = "NAME"
.HeaderText = "Name"
End With
dgvPersons.Columns.Add(NameColumn)
但是,如何添加一个绑定到地址属性的地址列的列?