467,146 Members | 1,329 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,146 developers. It's quick & easy.

Combo Box Update Problem

I have a combo box in which I've set the DataSource to an
instance of an ArrayList. The contents of the ArrayList
is managed in a timer control's timer_elapsed event
handler. The number of items in the ArrayList may
increase or decrease. When the contents of the ArrayList
changes, I try to update the choices in the combo box. I
can get the list to display correctly when items are
initially added to the ArrayList, but after that, I can't
change the list. I've tried a variety of things,
including the combo box's Update() and Refresh() methods.
Nothing I've tried works.
Can someone help me out?
Thanks in advance,
db_from _mn
Nov 15 '05 #1
  • viewed: 5733
Share:
2 Replies
db_from_mn,

The reason this doesn't work is because the ArrayList doesn't implement
the IBindingList interface. This interface is used in data binding to allow
binders to know when the underlying list changes. In order to get around
this, you should create a class that either wraps the ArrayList, or
subclasses ArrayList and implements IBindingList. The ListChanged event on
the interface will let binders know that the list has changed.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"db_from_mn" <an*******@discussions.microsoft.com> wrote in message
news:76****************************@phx.gbl...
I have a combo box in which I've set the DataSource to an
instance of an ArrayList. The contents of the ArrayList
is managed in a timer control's timer_elapsed event
handler. The number of items in the ArrayList may
increase or decrease. When the contents of the ArrayList
changes, I try to update the choices in the combo box. I
can get the list to display correctly when items are
initially added to the ArrayList, but after that, I can't
change the list. I've tried a variety of things,
including the combo box's Update() and Refresh() methods.
Nothing I've tried works.
Can someone help me out?
Thanks in advance,
db_from _mn

Nov 15 '05 #2
Hi Nick,
Thanks for the help. I'll give it a try.
Dennis
-----Original Message-----
db_from_mn,

The reason this doesn't work is because the ArrayList doesn't implementthe IBindingList interface. This interface is used in data binding to allowbinders to know when the underlying list changes. In order to get aroundthis, you should create a class that either wraps the ArrayList, orsubclasses ArrayList and implements IBindingList. The ListChanged event onthe interface will let binders know that the list has changed.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"db_from_mn" <an*******@discussions.microsoft.com> wrote in messagenews:76****************************@phx.gbl...
I have a combo box in which I've set the DataSource to an instance of an ArrayList. The contents of the ArrayList
is managed in a timer control's timer_elapsed event
handler. The number of items in the ArrayList may
increase or decrease. When the contents of the ArrayList changes, I try to update the choices in the combo box. I can get the list to display correctly when items are
initially added to the ArrayList, but after that, I can't change the list. I've tried a variety of things,
including the combo box's Update() and Refresh() methods. Nothing I've tried works.
Can someone help me out?
Thanks in advance,
db_from _mn

.

Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Maria Joao | last post: by
3 posts views Thread by ILCSP@NETZERO.NET | last post: by
1 post views Thread by James | last post: by
2 posts views Thread by Ausclad | last post: by
2 posts views Thread by fredloh@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.