更新时间:2022-05-22 03:07:34
您正在寻找 数据源属性
:
You're looking for the DataSource property
:
List<SomeType> someList = ...;
myListBox.DataSource = someList;
您还应该将 DisplayMember
属性设置为您希望列表框显示的对象中的属性名称.如果不这样做,它将调用 ToString()
.
You should also set the DisplayMember
property to the name of a property in the object that you want the listbox to display. If you don't, it will call ToString()
.