private void ChangeTab(object sender, EventArgs e) { if (tabControl1.SelectedIndex == 1) { listBox1.Items.Clear(); listBox2.Items.Clear(); foreach (Value mn in ValueList) { listBox2.Items.Add(mn.getName()); } } if (tabControl1.SelectedIndex == 0) { listBox1.Items.Clear(); listBox2.Items.Clear(); foreach (Value mn in ValueList) { listBox1.Items.Add(mn.getName()); } } }