Click here to Skip to main content
15,917,454 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi every body,
I develop a windows form application, i use in a form 12 combobox controls
as follows
cmb1, cmb2, cmb3 are three combobox databonded to dt1 ( a datatable).
cmb4, cmb5, cmb6, cmb7, cmb8 are databonded to dt2 (a datatable).
cmb9, cmb10, cmb11, cmb12 are databonded to dt3 .
when running the project
when i select an item from cmb2 :
cmb3 and cmb1 change their items also but different columns, because they are bonded to the same datatable, until now every thing is good
when i just do a click on any other combobox say cmb5 :
cmb1 and cmb3 change the selected text although cmb1 and cmb3 are bonded to a different datatable.
How i make the selected text of a combobox does not change when i click or change the selected text of another combobox .

C#
// Declare a datatable.
DataTable dt1=new DataTable();

// assign table tbl1 bindingsource to cmb1 as a datasource.
cmb1.DataSource=tbl1BindingSource;

// Declare datatable dt2.
Datatable dt2=new DataTable();
cmb2.DataSource=tbl2BindingSouce;

// Fill dt1 with some data from tbl1 using a stored procedure sptbl1 and dt2
// from tbl2.
dt1=sptbl1;
dt2=sptbl2;

tbl1BindingSource.DataSource=dt1;
tbl2BindingSource.DataSource=dt2;

this code is put in form_load event
in running the project when select an item from cmb1 then select an item from cmb2, cmb1 text change automatically, this is the problem.
Posted
Updated 9-Dec-14 5:31am
v2
Comments
Sergey Alexandrovich Kryukov 9-Dec-14 10:15am    
Not clear. Why your selection changes?
—SA
Praveen Kumar Upadhyay 9-Dec-14 10:22am    
Can you post your code along with this description.
You might have the same event defined for all the ComboBoxes. See the property of each ComboBox and check the change event.
fgeaiessah 9-Dec-14 10:56am    
The problem appears when running the project, if the user select an item from a combobox then the another comboboxes change automatically their text, although i made for every combobox its own event.
You need to actually debug the code and on each step, watch the value of a different ComboBox. You will come to know, where exactly it is changing the value. That will give you some hint.

Thanks,
Tadit

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900