private void button3_Click(object sender, EventArgs e) { if (NewLocation.Text == "") { MessageBox.Show(" Enter a Location and Countinue"); } else { string sql = "INSERT INTO `location` (`location`) VALUES ('" + NewLocation.Text + "')"; cmd = new MySqlCommand(sql, con); try { con.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("Successfully Location Added"); this.Close(); StockManagement s = new StockManagement(); s.Show(); } catch (Exception except) { MessageBox.Show(except.Message); } } }
private void button1_Click_1(object sender, EventArgs e) { bool b = false; foreach (Form f in Application.OpenForms) { if (f.Name == "StockManagement") { b = true; } } if (!b) { StockManagement st = new StockManagement(); toFront(st); } }