473,406 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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
2 5921
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Maria Joao | last post by:
I have two synchronized combo boxes and after the selection of the desired record, I need the user to open the related report, by pressing a button. My problem is that a combo box doesn't update...
1
by: JRT | last post by:
I have a continuous form with 3 comboxes, combo1, combo2 combo3. The choices in combo2 are dtermined the what is selected in combo1 by using a where = combo1 statement. The combo is refreshed...
3
by: mal | last post by:
Sorry for repost - system added to another subject for some reason Have tried numerous ideas from the group to solve this one. It is such a simple example that it should be straightforward ! I...
3
by: ILCSP | last post by:
Heello, I'm using Access 2000. I have a form with a combo box that has a query as its row source and it's bound to column 1. This combo box is unbound to a record like the rest of the form...
1
by: James | last post by:
I am used to VB6 but need to develop something in .Net. I need to create several bound combo-boxes which will use lookup tables to get their values. I created a form using the dataform wizard....
2
by: Ausclad | last post by:
How Would you implement this? I have an existing Access application that needs to be converted to .net I am restricted to use the existing database design. One of the areas is a timesheet...
5
by: debbie | last post by:
I have three combo boxes on a subform. I have tried setting them up so that when the user clicks in the combo box the curser moves to the left. I have searched the posts and can find nothing that...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
1
by: gdixon | last post by:
Greetings To All! I am using a Access 2003 and my programing skills are of the cut and paste variety. This means begining programming skills and on a good day perhaps middle of the road...
2
by: fredloh | last post by:
i have a table with a yes/no field call "Edited". i have a button that runs code to set the "Edited" field of a selected record to "yes". the code also set the rowsource (using SQL Update and Set...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.