void clear() { comboBox1.Text = ""; s = new TMS.purchase(); textBox1.Text = s.getpurchaseid().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); purchase s = new purchase(); if (s.delete(key)) { MessageBox.Show("Deletion Successful", "Delete"); } else { MessageBox.Show("Deletion Unsuccessful", "Delete"); } } clear(); }