CodeWrangler
asked on
ComboBox issues in .Net 2008 C# Windows Forms application
I have a simple combobox that is populated using a dataset which gets data from a SQL server. This combobox (cmb1) is populated during the form's Load event
On the cmb1_SelectedIndexChanged event, I have another combobox (cmb2) populating based on the cmb1's value.
Problem is, whe the form loads, the second combo box is getting populated with the first element in cmb1. I need cmb2 to remain blank until the user selects something in cmb1.
On the cmb1_SelectedIndexChanged event, I have another combobox (cmb2) populating based on the cmb1's value.
Problem is, whe the form loads, the second combo box is getting populated with the first element in cmb1. I need cmb2 to remain blank until the user selects something in cmb1.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Figured it out. Thanks Kaufmed. Even though you suggested something I had already tried, it got me thinking on something I did incorrectly.
ASKER
In case someone wanders in here for any combobox issues.. if you are wondering why the _SelectedIndexChanged event is firing when trying to populate comboxes using SQL.. use:
if (cmbKey2.SelectedIndex > -1 && cmbKey2.ContainsFocus == true)
{....}
if (cmbKey2.SelectedIndex > -1 && cmbKey2.ContainsFocus == true)
{....}
ASKER