Nutty Sorted BindingList Problem

  • Thread starter Thread starter Andreas Zita
  • Start date Start date
A

Andreas Zita

Hi

I have a simple problem scenario with yet no good solution:

I want: A sorted (by name) and bindable typesafe collection (of students)
which I can set as DataSource to a ListBox. When editing a students name in
a databound textbox, the name in the listbox should update and also resort
itself (while also keeping this student in focus).

I dont want to use DataGridView since its to complex. I just want a simple
selectable text item. Thats it.

How can this be done??

Previous attempts in .NET 1.1 with CollectionBase (and IBindingList) and
InnerList.Sort() almost worked. There, the problem was that when editing the
name (and manually sorting the list), the datamanager lost focus on the
previous student if it was moved while sorting and now selected a different
student.

New attempts in .NET 2.0 with a generic BindingList<T> revealed that
InnerList.Sort() is not available anymore at all??

I don't get this at all. This should be simple, yes? A simple list of
students with a binding to a sorted listbox and a textbox. Any help is
greately appreciated!!!

/Andreas Zita
 
Okey so InnerList is replaced by converting IList<T> this.Items to a generic
List<T>, it seemes. The other focus problem was solved also ... by not
invoking Reset but ItemMoved instead after a Sort-call.

/Andreas Zita

*Thread Closed*
 
Back
Top