private void btnSave_Click(object sender, EventArgs e) { if (txtname.Text.Trim() == "" || txtaddrs.Text.Trim() == "") { MessageBox.Show("Invalid Entry"); if (txtname.Text.Trim() == "") { txtname.Focus(); } else if (txtaddrs.Text.Trim() == "") { txtaddrs.Focus(); } } else { SqlConnection con = new SqlConnection(); con.ConnectionString = clsDbForReports.constr; con.Open(); SqlCommand cmd = new SqlCommand("", con); cmd.CommandText = " insert into tCustExcecutive (name, address)values (@name, @address)"; cmd.Parameters.AddWithValue("@name", txtname.Text); cmd.Parameters.AddWithValue("@address", txtaddrs.Text); cmd.ExecuteNonQuery(); con.Close(); MessageBox.Show("Saved Sucessfully"); this.Hide(); frmFinishedProductsOutward obj = new frmFinishedProductsOutward(); } }
private void outWardToolStripMenuItem_Click(object sender, EventArgs e) { frmFinishedProductsOutward obj = new frmFinishedProductsOutward(); obj.MdiParent = this; obj.StartPosition = FormStartPosition.CenterScreen; obj.Show(); }