Advertisement

05.06.2008 at 04:42AM PDT, ID: 23379085
[x]
Attachment Details

Multiple ComboBoxes to the same datatable

Asked by tcss in Microsoft Visual C#.Net

Hi

I havea a form om whih I have 2 comboboxes.
These controls are bound to the same datatable.
One CB is the code, the other is the description, allowing the user to enter either the code or descritionto select an item.
Both have hint set to true.
Under normal opperation when I select an item in the one combo box the other CB shows the corresponding value from the data table.

However (here it comes)
when I select the first item from the drop down list or press the down arrow key to get to the first item, the other list (does not matter if I use code or description) does not get populated. The second one is OK, If I select any but the first one in the dropdown, it is ok - both are populated.
If I remove the selected index change event, it makes no difference.



Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
cmbObjectiveAccount.DataBindings.Clear();
string SQLString = "SELECT tblObjectives.Code, tblObjectives.Description " +
"FROM  tblResponsibility_Objective INNER JOIN tblObjectives ON tblResponsibility_Objective.ObjectiveCode = tblObjectives.Code " +
" WHERE (tblResponsibility_Objective.ResponibilityCode = '" + Responsibility + "') ORDER BY tblObjectives.Description ";
dtObjectiveAccount = GetDataTable(SQLString);
cmbObjectiveAccount.DataSource = dtObjectiveAccount;
cmbObjectiveAccount.DisplayMember = "Description";
cmbObjectiveAccount.ValueMember = "Code";
cmbObjectiveAccount.DataBindings.Add("SelectedValue", bs, "CTRD_ObjectiveAccount");
 
cmbObjectiveAccountCode.DataBindings.Clear();
cmbObjectiveAccountCode.DataSource = dtObjectiveAccount;
cmbObjectiveAccountCode.DisplayMember = "Code";
cmbObjectiveAccountCode.ValueMember = "Code";
cmbObjectiveAccountCode.DataBindings.Add("SelectedValue", bs, "CTRD_ObjectiveAccount");
[+][-]05.06.2008 at 05:27AM PDT, ID: 21506618

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual C#.Net
Sign Up Now!
Solution Provided By: ShazbotOK
Participating Experts: 1
Solution Grade: B
 
 
[+][-]05.06.2008 at 05:40AM PDT, ID: 21506687

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.06.2008 at 10:26PM PDT, ID: 21513353

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.13.2008 at 09:34AM PDT, ID: 21556763

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.15.2008 at 07:07AM PDT, ID: 21573760

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906