I have a collection derived from CollectionBase. I am setting the DataSource
of my ListBox to the collection. That all works. I have two problems:
The code just after the call to InitializeComponent() looks like this:
shareListBox.DisplayMember = "Filename";
shareListBox.DataSource = shares;
shareListBox.ClearSelected();
'shares' is my collection.
1: When I set the DataSource, it immediately selects the first item. I don't
want anything selected by default. Calling ClearSelected() doesn't work, nor
does ListBox.SelectedItem = -1 (which I gather is what ClearSelected() does
anyway).
2: When I add an item to the 'shares' collection, how do I update the
ListBox?
I'm actually embarassed to ask the second question since I wrote a databound
grid custom control for a client, but for the life of me, I can't remember
how (if?) I handled that issue.
I know with DataSet, DataTable, etc, this is all handled via the
IBindingList and the CurrencyManager, but how is it handled with a
collection that doesn't implement IBindingList?
Thanks.
Pete