combo box on a windows form
-
I'm trying to use a combo box on a windows form which will change its display on event of changing combo selection. This is the method I wrote:
private void SurveyChooserCombo_SelectedIndexChanged(object sender, EventArgs e) { DAL dal = new DAL(); switch (SurveyChooserCombo.SelectedIndex) { case 0: SrNo = 1; break; case 1: SrNo = 2; break; case 2: SrNo = 3; break; default: SrNo = 3; break; }
It doesn't do the job. Please help me find why. TIA, sea#
-
I'm trying to use a combo box on a windows form which will change its display on event of changing combo selection. This is the method I wrote:
private void SurveyChooserCombo_SelectedIndexChanged(object sender, EventArgs e) { DAL dal = new DAL(); switch (SurveyChooserCombo.SelectedIndex) { case 0: SrNo = 1; break; case 1: SrNo = 2; break; case 2: SrNo = 3; break; default: SrNo = 3; break; }
It doesn't do the job. Please help me find why. TIA, sea#
What is SrNo? What do you want to change in the combo box?
Tech, life, family, faith: Give me a visit. I'm currently blogging about: Homosexuality in Christianity Judah Himango
-
I'm trying to use a combo box on a windows form which will change its display on event of changing combo selection. This is the method I wrote:
private void SurveyChooserCombo_SelectedIndexChanged(object sender, EventArgs e) { DAL dal = new DAL(); switch (SurveyChooserCombo.SelectedIndex) { case 0: SrNo = 1; break; case 1: SrNo = 2; break; case 2: SrNo = 3; break; default: SrNo = 3; break; }
It doesn't do the job. Please help me find why. TIA, sea#
-
SrNo, which is an int represents survey no. Each time I change the item in combo, it is changed. "doesn't do the job" means SurveyChooserCombo.SelectedIndex seems to be left unchanged. When I run the application the form doesn't change the display as expected. Also cannot run it in debug mode, as I get "there is no source code available for current location", when trying to run over method more then once- to make the change in index come true. sea#
-
I'm trying to use a combo box on a windows form which will change its display on event of changing combo selection. This is the method I wrote:
private void SurveyChooserCombo_SelectedIndexChanged(object sender, EventArgs e) { DAL dal = new DAL(); switch (SurveyChooserCombo.SelectedIndex) { case 0: SrNo = 1; break; case 1: SrNo = 2; break; case 2: SrNo = 3; break; default: SrNo = 3; break; }
It doesn't do the job. Please help me find why. TIA, sea#
Are you sure you have added event handler? i.e. comboBox.SelectedIndexChanged+=new SelectionChangeHandler(<>) ??? This is done automatically by Visual Designer - simply naming method SurveyChooserCombo_SelectedIndexChanged does not automatically associate it with the control... - Another possibility is that the event may not be fired if combo box list style is not a selection from drop-down list but a mixture of type-in and select from the list... Hope this helps. Regards JP
-
Are you sure you have added event handler? i.e. comboBox.SelectedIndexChanged+=new SelectionChangeHandler(<>) ??? This is done automatically by Visual Designer - simply naming method SurveyChooserCombo_SelectedIndexChanged does not automatically associate it with the control... - Another possibility is that the event may not be fired if combo box list style is not a selection from drop-down list but a mixture of type-in and select from the list... Hope this helps. Regards JP
Petras J. wrote: Are you sure you have added event handler? i.e. comboBox.SelectedIndexChanged+=new SelectionChangeHandler(<>) ??? I do have event handler. Petras J. wrote: - Another possibility is that the event may not be fired if combo box list style is not a selection from drop-down list but a mixture of type-in and select from the list... it is just an ordinary drop-down list. Nothing complicated. What else should I do to make it change once selction changed? TIA, sea#
-
Petras J. wrote: Are you sure you have added event handler? i.e. comboBox.SelectedIndexChanged+=new SelectionChangeHandler(<>) ??? I do have event handler. Petras J. wrote: - Another possibility is that the event may not be fired if combo box list style is not a selection from drop-down list but a mixture of type-in and select from the list... it is just an ordinary drop-down list. Nothing complicated. What else should I do to make it change once selction changed? TIA, sea#
Wrote this code:
private void SurveyChooserCombo_SelectedIndexChanged(object sender, EventArgs e)
{
if (SurveyChooserCombo.Text.Equals("Survey1"))
SrNo = 1;
else if (SurveyChooserCombo.Text.Equals("Survey2"))
SrNo = 2;
else if (SurveyChooserCombo.Text.Equals("Survey3"))
SrNo = 3;
else
SrNo = 3;
GetResults (SrNo);
}stil event is not fired, dsiplay doesnot changed.