private void deleteBtn_Click(object sender, EventArgs e) { if (this.textBox1.Text == "" || this.dateTimePicker1.Text == "") { MessageBox.Show("please insert Data"); } else { string date = this.dateTimePicker1.Value.ToShortDateString(); AccountingRepository ar = new AccountingRepository(); if (ar.Delete(date)) { List <AccountingR> allResult = ar.GetAllTransiction(); this.dataGrid1.DataSource = allResult; this.textBox1.Text = ""; this.dateTimePicker1.Text = ""; } else { MessageBox.Show("Can Not Delete transition", "Delete Error"); } } }