Hi,
When I set the DataSource property for two listboxes to the same list (List) and I select an item in one listbox, this is automatically selected in the second listbox too. That is pretty weird behaviour in my opinion. Has anyone seen that before? Is it a know bug in Visual Studio Professional 2012 (11.0.61030.00 update 4) / .NET framework 4.5.50709 ?
Thanx,
André
example code (in form with two listboxes, MyClass just some class):
Listclasses = new List (10);
for (int k = 1; k < 6; k++)
{
MyClass d = new MyClass(k.ToString(), String.Format("name-{0}", k));
classes.Add(d);
}
listBox1.DataSource = classes;
listBox2.DataSource = classes;
Andre HendriksPosted Mar 9, 2015, 4:00 AM
Tom MohanPosted Mar 6, 2015, 11:21 AM
VulpesPosted Mar 6, 2015, 11:12 AM
If you want the listboxes to behave independently, then I'd wrap your list in different BindingSource objects: