473,383 Members | 1,795 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,383 software developers and data experts.

Add an item into only one combobox which is binded with a list bound to multiple ctrl

I've a list of items which I bound to multiple combo boxes.
In the due course in the code...I had to add an item into one combo box...but I don't want it to be reflected into any other combo boxes...How should I do that...
As when I'm trying to add an item...it is being shown in all the combo boxes.

Expand|Select|Wrap|Line Numbers
  1. private void FillMethod() 
  2.            BindingSource bs = new BindingSource();
  3.             BindingSource bs1 = new BindingSource();
  4.             BindingSource bs2 = new BindingSource(); 
  5.  
  6.             List<string> list = Filldata();
  7.             bs.DataSource = list;
  8.             bs1.DataSource = list;
  9.             bs2.DataSource = list; 
  10.  
  11.            comboBox1.DataSource = bs;
  12.            comboBox2.DataSource = bs1; 
  13.            comboBox3.DataSource = bs2;
  14.  
  15.           combobox1.items.add("sai");
  16. }
  17.  
Apr 14 '09 #1
4 3148
Bassem
344 100+
Expand|Select|Wrap|Line Numbers
  1. private void FillMethod() 
  2.            bs.DataSource = list;
  3.            comboBox1.DataSource = bs.Clone();
  4.            comboBox2.DataSource = bs.Clone(); 
  5.            comboBox3.DataSource = bs.Clone();
  6.  
  7.           combobox1.items.add("sai");
  8. }
  9.  
I tested none, but I'm sure that DataSource of each ComboBox now has a different copy of list.
Apr 14 '09 #2
We don't have Clone method in binding source.

My requirement is adding one item in only one combo box and it should not reflect in our combo boxes...
Apr 15 '09 #3
Bassem
344 100+
OK.
You may do this.
Expand|Select|Wrap|Line Numbers
  1. private void FillMethod() 
  2.            comboBox1.DataSource = list.Clone();
  3.            comboBox2.DataSource = list.Clone(); 
  4.            comboBox3.DataSource = list.Clone();
  5.  
  6.           combobox1.items.add("sai");
  7. }
It's not about Clone Method. To not affect on the other DataSource they've to be different.
Apr 16 '09 #4
tlhintoq
3,525 Expert 2GB
I've a list of items which I bound to multiple combo boxes.
In the due course in the code...I had to add an item into one combo box...but I don't want it to be reflected into any other combo boxes...How should I do that...
As when I'm trying to add an item...it is being shown in all the combo boxes.
As it would be. Same source equals same result. If you want different result then you need a different source.

Walk it through in your mind for a moment... How can you envision a way to tell the computer to filter a single list so that some items are in combobox1 and others in combobox3? All items that start with the letter 'g'? Only items 1,4,8?

Whatever criteria you can devise for the filtering would have to be done first... get those results... then add those results to the Combobox.Items collection directly instead of trying to do it with binding.
Apr 17 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Phil | last post by:
My form uses a dataset containing two tables, a base table (Contact) and a lookup table (Insurer). My combobox is bound as follows: DataSource = datasetContact DisplayMember =...
9
by: Bob Alston | last post by:
I have a drop down combo box that gives the user to enter an item not in the list by adding it to the list. The list is a table. It works fine on Access2003 but fails on Access2002/XP. ON XP, it...
6
by: Johann Blake | last post by:
I fill a table in a dataset with values that will be used by a combobox for the combobox's items. The combobox is a drop down list that only allows the user to select from the list but not enter...
9
by: Kay | last post by:
Hi all, Could you tell me the best way to add a blank item(as first item) in a data binded combo box? Because I think I didn't do it right and it generate an error if the second item(after the...
1
by: TheMadHatter | last post by:
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...
3
by: sklett | last post by:
I'm changing from a DataGrid to a DataGridView and have run across a problem. The items that are bound to the DataGrid have an int Property that represents a primary key of a lookup table in my...
4
by: Jerad Rose | last post by:
I'm baffled by this -- is there not a typed object used for ComboBox Items? Best I can tell, all of the methods for ComboBox that accept an Item are of type Object. Why in the world is a...
6
akashazad
by: akashazad | last post by:
Hi Friends, Question:- In my VB6.0 Form I have used a ComboBox and a ToolBar in which I have provided some buttons such as Add,Modify,Abort,Delete,Save,Print,Exit. and also provided shortcuts to...
10
by: =?Utf-8?B?UiBSZXllcw==?= | last post by:
Hi, Problem: How can I databind (or put) a SqlServer query's row return of 115,000 items into a ComboBox quickly? Not much longer than a matter of seconds, that is... Scenario: I am...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.