private void CommonRej_Click(object sender, EventArgs e) { CountForm cf = new CountForm((sender as Button).Text); cf.Show(); }
private void Btn_Click(object sender, EventArgs e) { if (Mode == "Normal") { Code = (sender as Button).Text; CountForm cf = new CountForm(Code); cf.Show(); Close(); } else if (Mode == "Common") { foreach (CommonRejectsSet crs in Application.OpenForms.OfType <CommonRejectsSet>().ToList()) { if (Btn == 1) { crs.BTNCom1.Text = (sender as Button).Text; Close(); } else if (Btn == 2) { crs.BTNCom2.Text = (sender as Button).Text; Close(); } else if (Btn == 3) { crs.BTNCom3.Text = (sender as Button).Text; Close(); } else if (Btn == 4) { crs.BTNCom4.Text = (sender as Button).Text; Close(); } else if (Btn == 5) { crs.BTNCom5.Text = (sender as Button).Text; Close(); } else if (Btn == 6) { crs.BTNCom6.Text = (sender as Button).Text; Close(); } else if (Btn == 7) { crs.BTNCom7.Text = (sender as Button).Text; Close(); } else if (Btn == 8) { crs.BTNCom8.Text = (sender as Button).Text; Close(); } else if (Btn == 9) { crs.BTNCom9.Text = (sender as Button).Text; Close(); } else { throw new Exception($"{Btn} is not a valid Common Reject number"); } } } else { throw new Exception($"{Mode} is not a valid mode"); } }