By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,795 Members | 1,761 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,795 IT Pros & Developers. It's quick & easy.

How do I refresh a ComboBox who has ArrayList as Datasource?

P: n/a
I have a ComboBox on my form, and I set it's DataSource to an ArrayList of
custom objects. Everything loads fine, all the entries I initially loaded
into the ArrayList appear in my ComboBox.

However, while my program is running and I add a new object to that
ArrayList - this ComboBox is not updating to reflect the change.

I have gone so far as to try:

clientList.Invalidate();
clientList.DataSource = RecordKeeper.RecordList;
clientList.Refresh();

all at once in that order.

and still can't get the ComboBox to refresh...

how do I do this?
Oct 5 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In article <2B**********************************@microsoft.co m>,
Mr******@discussions.microsoft.com says...
I have a ComboBox on my form, and I set it's DataSource to an ArrayList of
custom objects. Everything loads fine, all the entries I initially loaded
into the ArrayList appear in my ComboBox.

However, while my program is running and I add a new object to that
ArrayList - this ComboBox is not updating to reflect the change.

I have gone so far as to try:

clientList.Invalidate();
clientList.DataSource = RecordKeeper.RecordList;
clientList.Refresh();

all at once in that order.
I think the easiest way is to "unbind" the combobox and then "rebind"
it. It probably has some internal "smarts" to not rebind if you set the
DataSource equal to the DataSource it's already bound to:

ClientList.DataSource = null;
ClientList.DataSource = RecordKeeper.RecordList;

--
Patrick Steele
http://weblogs.asp.net/psteele
Oct 5 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.