G
Guest
Is there a reason why the BindingList constructor doesn't create a new
BindingList?
Create a form with four ListBoxes and the following will result in them all
containing the exact same thing. The expected behavior would be for each of
the first three to contain different sets numbers.
public Form1()
{
InitializeComponent();
BindingList<string> l1 = new BindingList<string>();
l1.Add("1");
l1.Add("2");
l1.Add("3");
listBox1.DataSource = l1;
BindingList<string> l2 = new BindingList<string>(l1);
listBox2.DataSource = l2;
BindingList<string> l3 = new BindingList<string>(l1);
listBox3.DataSource = l2;
l1.Remove("1");
l2.Remove("2");
listBox4.DataSource = l1;
}
BindingList?
Create a form with four ListBoxes and the following will result in them all
containing the exact same thing. The expected behavior would be for each of
the first three to contain different sets numbers.
public Form1()
{
InitializeComponent();
BindingList<string> l1 = new BindingList<string>();
l1.Add("1");
l1.Add("2");
l1.Add("3");
listBox1.DataSource = l1;
BindingList<string> l2 = new BindingList<string>(l1);
listBox2.DataSource = l2;
BindingList<string> l3 = new BindingList<string>(l1);
listBox3.DataSource = l2;
l1.Remove("1");
l2.Remove("2");
listBox4.DataSource = l1;
}