private void init() { Select select = new Select("localhost", "root", "train", "3306", ""); Form3 form = new Form3(); Console.WriteLine(form.getId()); List <string> list = new List <string>(select.SelectS(form.getId())); for (int i = 0; i < 56; i++) { if (Convert.ToBoolean(list[i])) { int index = i + 1; string check = "checkBox" + index; CheckBox checkBox = this.Controls.Find(check, true).FirstOrDefault() as CheckBox; checkBox.Checked = true; checkBox.Enabled = false; } } }
private void button2_Click(object sender, EventArgs e) { Select select = new Select("localhost", "root", "train", "3306", ""); setList(); Form3 form = new Form3(); select.Update(form.getId()); MessageBox.Show("Змінено"); this.Hide(); new Form1().ShowDialog(); }