What is the proper way to load up a ListBox?

后端 未结 6 836
我寻月下人不归
我寻月下人不归 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条回答
  •  暖寄归人
    2020-12-05 05:14

    You can bind a DataTable directly...

    listbox.ValueMember = "your_id_field";
    listbox.DisplayMember = "your_display_field";
    listbox.DataSource = dataTable;
    

提交回复
热议问题