private void btnSave_Click(object sender, EventArgs e) { if (txtUnit.Text != "") { con.Open(); cmd = new SqlCommand("Insert into Unit(QuantityType) values(@b)", con); cmd.Parameters.AddWithValue("@b", txtUnit.Text); try { int r = cmd.ExecuteNonQuery(); MessageBox.Show("Material Unit Added Succesfully", "Unit Added", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception exc) { MessageBox.Show(exc.ToString()); } finally { txtUnit.Text = ""; con.Close(); } } else { MessageBox.Show("Fill Required Feilds", "", MessageBoxButtons.OK, MessageBoxIcon.Stop); } Unit u = new Unit(); u.Show(); }
private void newEntryToolStripMenuItem5_Click(object sender, EventArgs e) { Unit u = new Unit(); u.Show(); }