G
Greg Smith
I am experiencing strange behavior working with multiple
ComboBoxes on a form.
I have several ComboBoxes that I configure in code the
way I have in the past (only a single ComboxBox on the
form). Whatever I configure the last ComboxBox to, it
changes all the previous ComboBoxes to the same displayed
value.
Here is the code:
private void Form1_Load(object sender, System.EventArgs e)
{
da.Fill(ds.tblQuestions);
daTypes.Fill(ds.tblQuestionTypes);
BindCB1();
BindCB2();
}
private void BindCB1()
{
comboBox1.DataSource = ds;
comboBox1.DisplayMember
= "tblQuestionTypes.QuestionTypeDesc";
comboBox1.ValueMember
= "tblQuestionTypes.QuestionTypeNumber";
comboBox1.DataBindings.Add("SelectedValue",
ds, "tblQuestions.Question01Type");
comboBox1.DropDownStyle.Equals("DropDownList");
}
private void BindCB2()
{
comboBox2.DataSource = ds;
comboBox2.DisplayMember
= "tblQuestionTypes.QuestionTypeDesc";
comboBox2.ValueMember
= "tblQuestionTypes.QuestionTypeNumber";
comboBox2.DataBindings.Add("SelectedValue",
ds, "tblQuestions.Question02Type");
comboBox2.DropDownStyle.Equals("DropDownList");
}
Any help is greatly appreciated.
ComboBoxes on a form.
I have several ComboBoxes that I configure in code the
way I have in the past (only a single ComboxBox on the
form). Whatever I configure the last ComboxBox to, it
changes all the previous ComboBoxes to the same displayed
value.
Here is the code:
private void Form1_Load(object sender, System.EventArgs e)
{
da.Fill(ds.tblQuestions);
daTypes.Fill(ds.tblQuestionTypes);
BindCB1();
BindCB2();
}
private void BindCB1()
{
comboBox1.DataSource = ds;
comboBox1.DisplayMember
= "tblQuestionTypes.QuestionTypeDesc";
comboBox1.ValueMember
= "tblQuestionTypes.QuestionTypeNumber";
comboBox1.DataBindings.Add("SelectedValue",
ds, "tblQuestions.Question01Type");
comboBox1.DropDownStyle.Equals("DropDownList");
}
private void BindCB2()
{
comboBox2.DataSource = ds;
comboBox2.DisplayMember
= "tblQuestionTypes.QuestionTypeDesc";
comboBox2.ValueMember
= "tblQuestionTypes.QuestionTypeNumber";
comboBox2.DataBindings.Add("SelectedValue",
ds, "tblQuestions.Question02Type");
comboBox2.DropDownStyle.Equals("DropDownList");
}
Any help is greatly appreciated.