I have a listbox on my form which is bounded to a bindingsource.
The collection is of type List<T>.
If I add new elements to the bindingsource, I would like to select them in the listbox.
A sample like the following is working...but it is not working when the list contains an object.
int cnt = listBox2.Items. Count;
for (int i = cnt; i < (cnt + 10); i++)
{
bindingSource2. List.Add(i.ToSt ring());
}
for(int i = cnt; i < (cnt+10); i++)
{
listBox2.SetSel ected(i, true);
}
Any hints on how to select the added items in listbox!
The selectionmode of this listbox uses MultiExtended property.
The collection is of type List<T>.
If I add new elements to the bindingsource, I would like to select them in the listbox.
A sample like the following is working...but it is not working when the list contains an object.
int cnt = listBox2.Items. Count;
for (int i = cnt; i < (cnt + 10); i++)
{
bindingSource2. List.Add(i.ToSt ring());
}
for(int i = cnt; i < (cnt+10); i++)
{
listBox2.SetSel ected(i, true);
}
Any hints on how to select the added items in listbox!
The selectionmode of this listbox uses MultiExtended property.
Comment