void clear() { comboBox1.Text = ""; s = new TMS.sale(); textBox1.Text = s.getsaleid().ToString(); dateTimePicker1.Value = DateTime.Now; dataGridView1.Rows.Clear(); dataGridView1.Refresh(); textBox2.Text = ""; textBox3.Text = "0"; button2.Hide(); button3.Hide(); button5.Hide(); button1.Show(); }
private void button3_Click(object sender, EventArgs e) { if ((MessageBox.Show("Are You Sure to Delete the Record", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)) { int key = Convert.ToInt32(textBox1.Text); sale s = new sale(); if (s.delete(key)) { MessageBox.Show("Deletion Successful", "Delete"); } else { MessageBox.Show("Deletion Unsuccessful", "Delete"); } } clear(); }