I have a Form that has 3 radio buttons grouped together. I have a default combobox selected on the form. When a user selects a item from the combo box a new combo box appears that is populated from the data in a access DB. Problem is that right now when you select a selection the new combo box does not appear. It instead appears when you select one of the other radio buttons then go back to the original ComboBox.
Here is the code.
First Part is the radio button which calls the next function
private void optProductColor_CheckedChanged(object sender, EventArgs e)
{
try
{
if (optProductColor.Checked == true)
{
this.lblProductColor.Visible = true;
this.cmbProductColor.Visible = true;
this.lblCustomerType.Visible = false;
this.cmbCustomerType.Visible = false;
GetProductColors();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Here is the next function
private void GetProductColors()
{
try
{ //DB calls to Stored Procedure
//Read the DB into our ComboBox
while (oleDbDataReader1.Read() == true)
{
this.cmbProductColor.Items.Add(oleDbDataReader1.GetString(0));
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
oleDbConnection1.Close();
}
//Get Selection from Combo Box
string strSelection = cmbProductColor.SelectedItem.ToString();
//Make next combobox visible
this.cmbFirstColor.Visible = true;
//Send String to First Imprint Color
GetFirstImprintColors(strSelection);
}
This calls the next function which is not displayed until I leave the radio button and then come back
private void GetFirstImprintColors(string strSelection)
{
try
{
//See if DB is open
//DB calls
//Read the DB into our ComboBox
while (oleDbDataReader1.Read() == true)
{
this.cmbFirstColor.Items.Add(oleDbDataReader1.GetString(0));
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
oleDbConnection1.Close();
}
}
How do I make each combo box visible after a selection is selected? Like a chain reaction?
Thanks