I have two databound listboxes. The first only shows items that have been assigned to my product. The second listbox shows all available items. What I want to do is开发者_如何学Python select all of the items in listbox 2 that list box one contains.
For example:
ListBox1- Item 1 Item 3 ListBox2- Item 1 (Selected) Item 2 Item 3 (Selected)Code I have:
List<string> myList = new List<string>();
            foreach(ListItem f in ListBoxSourceDetail.Items)
            {
                myList.Add(f.Value);
            }
            myList.ForEach(delegate(string n)
            {
                ListBoxSourceEdit.SelectedValue = n;
            });
I figured it out, I was over thinking it... Loop through each list item in the first box and then find each matching result in the second table to be selected.
foreach(ListItem i in ListBoxSourceDetail.Items)
        {
            ListBoxSourceEdit.Items.FindByText(i.ToString()).Selected = true;
        }
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论