What is the proper way to load up a ListBox?

后端 未结 6 840
我寻月下人不归
我寻月下人不归 2020-12-05 05:00

What is the proper way to load a ListBox in C# .NET 2.0 Winforms?

I thought I could just bind it to a DataTable. No such luck.
I though

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-05 05:19

    You can set the datasource to whatever datasource you like that implements the IList or IListSource.

    You will also need to set the DisplayMember and the ValueMember properties to the fields you want to display and have the values associated with respectively.

提交回复
热议问题