Setting selected item in a ListBox without looping

后端 未结 7 1629
萌比男神i
萌比男神i 2020-12-31 19:00

I have a multi-select listbox which I am binding to a DataTable. DataTable contains 2 columns description and value.

Here\'s the listbox populating code:

         


        
7条回答
  •  无人及你
    2020-12-31 19:10

    Here's how I solved it, using winforms, DotNet 4.6

    listBox1.SelectedIndex = listBox1.FindString(stringInList);
    

提交回复
热议问题