Link to home
Start Free TrialLog in
Avatar of ARACK04
ARACK04

asked on

changing datasource

I have a listbox which has a datasource set to a List collection.

I'm trying to remove an item from the List, and then reload the listbox - expecting to see the removed item no longer present in the listbox.  Here is the code to do that:

            source.RemoveAt(0);
            listBox1.DataSource = source;
            listBox1.DisplayMember = "str";

For some reason the listbox remains the same after I execute this code.  I know the code is getting reached since if I execute it enough times, an exception is raised, since there are no more items left to remove from the List.  Thannks!
ASKER CERTIFIED SOLUTION
Avatar of e1v
e1v

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial