When I check the following code, there is nothing in any of the ComboBoxes
. For me, everything is normal, I do not see anything wrong, what can it be?
public FormExemplo()
{
ExemploList = new List<string[]>;
CmbB.Enabled = false;
}
private void AttCmbA(ComboBox A)
{
A.Items.Clear();
for (i = 0; i < ExemploList.Count; i++)
{
A.Items.Add(ExemploList[i][0]);
}
}
private void AttCmbB(ComboBox A, ComboBox B)
{
B.Items.Clear();
for (int i = 0; i < ExemploList.Count; i++)
{
if (A.SelectedItem.Equals(ExemploList[i][0]))
{
for (int j = 0; j < 3; j++)
{
CmbB.Add(ExemploList[i][j]);
}
}
}
}
private void CmbA_SelectedIndexChanged(object sender, EventArgs e)
{
CmbB.Enabled = true;
AttCmbB(CmbA, CmbB);
}
private List<string[]> ExemploList;
private void Btn_Click(object sender, EventArgs e)
{
for (int i = 0; i < 10; i++)
{
ExemploList.Add(new string[3] { (2 * i).ToString(), (2 * (i++)).ToString(), (2 * (i * i).ToString() });
}
AttCmbA(CmbA);
}