What is the proper way to load up a ListBox?

后端 未结 6 834
我寻月下人不归
我寻月下人不归 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:36

    To bind to a dictionary you have to wrap it in a new BindingSource object.

    MyListBox.DataSource = New BindingSource(Dict, Nothing)
    MyListBox.DisplayMember = "Value"
    MyListBox.ValueMember = "Key"
    

提交回复
热议问题