473,399 Members | 3,106 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,399 software developers and data experts.

Synchronised ComboBoxes

Hi,
I have a "Settings" form with a number of Combo Boxes.

Several of these Combos have their DataSource set to an ArrayList.
I have found that changing the selected text for one combo also changes the
other combo boxes displayed text.

Why does this happen?
Do I need to create a separate ArrayList for each Combo?

Thanks Doug
Nov 21 '05 #1
4 929
Hi,

"Doug Bell" <Po*********@vodaphone.com.au> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,
I have a "Settings" form with a number of Combo Boxes.

Several of these Combos have their DataSource set to an ArrayList.
I have found that changing the selected text for one combo also changes
the
other combo boxes displayed text.

Why does this happen?
By default controls use their parent's BindingContext. If the
BindingContext, DataSource and DataMember are the same, then the same
CurrencyManager will be used which mantains the position.
Do I need to create a separate ArrayList for each Combo?
You can, but an alternative is to create a new BindingContext for each
ComboBox preferably before binding:

Dim someList As New ArrayList
' ....
'.....
comboBox1.BindingContext = new BindingContext
comboBox1.DataSource = someList

comboBox2.BindingContext = new BindingContext
comboBox2.DataSource = someList
HTH,
Greetings


Thanks Doug

Nov 21 '05 #2
Doug,

No it is easier to use a datatable. That has his own defaultview, however
you can add as much seperated new dataviews as you want.

I hope this helps,

Cor
Nov 21 '05 #3
Hi Bart,

Thanks. Works great!

"Bart Mermuys" <bm*************@hotmail.com> wrote in message
news:On**************@TK2MSFTNGP10.phx.gbl...
Hi,

"Doug Bell" <Po*********@vodaphone.com.au> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,
I have a "Settings" form with a number of Combo Boxes.

Several of these Combos have their DataSource set to an ArrayList.
I have found that changing the selected text for one combo also changes
the
other combo boxes displayed text.

Why does this happen?


By default controls use their parent's BindingContext. If the
BindingContext, DataSource and DataMember are the same, then the same
CurrencyManager will be used which mantains the position.
Do I need to create a separate ArrayList for each Combo?


You can, but an alternative is to create a new BindingContext for each
ComboBox preferably before binding:

Dim someList As New ArrayList
' ....
'.....
comboBox1.BindingContext = new BindingContext
comboBox1.DataSource = someList

comboBox2.BindingContext = new BindingContext
comboBox2.DataSource = someList
HTH,
Greetings


Thanks Doug


Nov 21 '05 #4
Cor Thanks,
I could have constructed a DataTable but it was easier to build an Array
list as I had 18 Combos with 8 different sets of data that each needed a
first row added ("Select xxxx") to the original DataTables and the original
DataTables were required in tact.

So I built a function to create the 8 different array lists.

Bart answered my question explaining about the inheritance of the Currency
manager.

Doug

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:Oz**************@tk2msftngp13.phx.gbl...
Doug,

No it is easier to use a datatable. That has his own defaultview, however
you can add as much seperated new dataviews as you want.

I hope this helps,

Cor

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Kathy | last post by:
In my custom menu one menu item opens a form to add new Makes to TblMakes and another menu item opens a form to add new Models to TblModels. I have a form that has a combobox for Makes and a...
0
by: johnson_cy | last post by:
I am using Access 2000. My main form has a record source of a table (employeeTbl with key of . It is filtering the record results. My subform and mainform have the link child/link master set...
0
by: Jason | last post by:
I want to create a synchronised queue class which has very simple functionality as a queue but is thread safe, where two different threads can add and remove items in such a way that doesn't...
1
by: Craig G | last post by:
for months we have been dabling round looking at various 3rd party comboboxes that allow the user to type text into the combobox as a search mechanism what we've found is that the likes of...
3
by: steve | last post by:
Hello, I have been trying to populate 2 or more controls from two *different* (related) tables for the last week without success. My latest try is: 2 simple SELECT statements in 2 adapters that...
1
by: Marcin Podle¶ny | last post by:
Hi, I've a form with three comboboxes. Each of them contains the same data - all cities in my country. As you see it's a lot of data so it takes a lot of memory. I'd like to use the same...
6
by: Sam | last post by:
Hi, I have a datagrid which has (amongst other stuff) 2 comboboxes columns. So far so good. The trick is that when I select a value in my first column, it must updates the items of the combobox in...
1
by: Macca | last post by:
Hi, I am considering using a Generic List to hold user defined class entries. Since this List will be accessed by multiple threads I need it to be threadsafe. It appears there is no easy way to...
2
by: Matt | last post by:
Hi all, me again! :) I've now got an issue with combo boxes. Basically, I have a number of items that I want a user to pick from a single list. It's basically along the lines of: Fruit 1: ...
2
by: Wingot | last post by:
Hey, I have a view to a database that I have created for Client Maintenance. It has a number of fields, but the important ones are Medical Condition, Bill To, and Country. I have a couple of...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.