private void button1_Click(object sender, EventArgs e) { if (InRecord()) { Form4 f4 = new Form4(); this.Hide(); f4.FormClosed += (s, args) => this.Close(); f4.Show(); f4.Focus(); } else { MessageBox.Show("Admin Not Found"); } }
private void button2_Click(object sender, EventArgs e) { try { Con.Open(); cmd = new SqlCommand("Create table " + tablename + "(" + temp + ");", Con); dr = cmd.ExecuteReader(); while (dr.Read()) { } Con.Close(); MessageBox.Show("table " + tablename + " has been successfully created"); Form4 f4 = new Form4(); f4.FormClosed += (s, args) => this.Close(); this.Hide(); f4.Show(); f4.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }