473,651 Members | 3,093 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

multiple comboBox one array datasource. help...


I have an array of a custom obj which I am trying
to use in multiple comboBoxes without creating multiple
copies, but if I put the datasource of the comboboxes to
the same array, then at runtime if I pick change a combobox,
all of them change to that value. I am guessing that it is
because all the comboboxes are using the same Ilist interface,
and the behind-the-sceens variables.

Now, I could create my own wrapper class to wrap the
array, but I was hoping that there was already one hiding
in plan sight in the frameworks.

Thanks in advance for all help on the issue.
Feb 16 '06 #1
1 2768
Hi,

"TheMadHatt er" <Th**********@d iscussions.micr osoft.com> wrote in message
news:2E******** *************** ***********@mic rosoft.com...

I have an array of a custom obj which I am trying
to use in multiple comboBoxes without creating multiple
copies, but if I put the datasource of the comboboxes to
the same array, then at runtime if I pick change a combobox,
all of them change to that value. I am guessing that it is
because all the comboboxes are using the same Ilist interface,
and the behind-the-sceens variables.

Now, I could create my own wrapper class to wrap the
array, but I was hoping that there was already one hiding
in plan sight in the frameworks.

If the two ComboBoxes SelectedValue isn't bound to a common table, list or
object then you can set a different BindingContext for each ComboBox:

comboBox1.Bindi ngContext = new BindingContext( );
comboBox2.Bindi ngContext = new BindingContext( );

But you could also use a wrapper (like you mentioned). I don't think there
anyhing available in NET1.1, but you could create one yourself (eg. based on
IListSource to keep it simple).

In NET2.0 you just put a different BindingSource between the List and the
ComboBox.

HTH,
Greetings

Thanks in advance for all help on the issue.

Feb 16 '06 #2

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

Similar topics

7
20763
by: charliewest | last post by:
Using .Net CF, i have created a 2 dimension ArrayList, and "binded" this list to a ComboBox control using the "DataSource" property. I have set the DisplaySource and ValueMember properties as well. The control populates well, both the display values, and selected values. However, when i try to "set" the SelectedValue or SelectedIndex properties, nothing happens.... The default blank value in the ComboBox is always selected. My code is: ...
2
1886
by: Bob | last post by:
I have an ArryList that I'm using as a datasource for a combobox. As an item is selected in the combobox and processed I'd like to remove it from the combobox. When I try I get an error stating that the arraylist is being used as a datasource and can't be updated. I can't remove it as the datasource for the combobox so I can update it and reassign it back as the datasource. Anyone got a workaround?
9
3983
by: Bob | last post by:
I want to remove the item from the combobox, but can't because I can't remove the ArrayList as being the datasource of the combobox so I can remove the item in the ArrayList and then assign it back as being the datasource of the combobox.
1
1409
by: Bob | last post by:
I have an arraylist (arlNAMES) that is bing used as a datasource for a combobox. When an item is selected in the combobox I want to remove it from both the combobox and the arraylist. This doesn't work. DOes anyone know why and how to fix it? Dim intPOS As Integer = cboAdvanceResponse.SelectedIndex cboAdvanceResponse.DataSource = Nothing arlNAMES.RemoveAt(intPOS) arlnames.TrimToSize arlREF.RemoveAt(intPOS)
0
1127
by: Richard | last post by:
I have a combobox that I use to display the advertising medium that attracted a client. On the Client's table is the foreign key AdvertisingMedium, and the combobox successfully reads the data from the AdvertisingMedium table by using a Category class to read the data into an array. I then set the datasource to read the array into the combobox. With cboAdvertisingMedium .DisplayMember = "Name" .ValueMember = "ID"
2
12506
by: AMDRIT | last post by:
Hello Everyone, I would like to format the Display Members of a combobox's datasource. Is there a way to apply a format without subclassing the original datasource? For example, given a list of decimal values, format them as currency values with a leading currency symbol and 2 decimal places. TIA Class Test
5
3188
by: Peter M. | last post by:
I'm struggling with combobox databinding with something I consider a bug... I'm binding my combobox to an array of structs. The struct exposes two public properties, ID and Name, to be used as the value and displaymember properties. This works fine. My combobox contains the correct data. However I'm also binding my SelectedValue property to a column in a datatable. Here's where I'm lost. The combobox doesn't show the correct
4
28223
by: polaris431 | last post by:
All the examples I've seen showing how to populate a combobox using the DataSource property and an ArrayList show the ArrayList object containing objects with at least two properties. I want to create an ArrayList that contains only rows of string data and want to assign this to the DataSource but I can't figure out what to set the ValueMember or DisplayMember to. Example ArrayList myData = new ArrayList(); myData.Add("abc");
2
11447
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: Fruit 2: Fruit 3:
0
8367
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8811
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6160
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4145
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2703
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.