private void updateBtn_Click(object sender, EventArgs e) { if (this.textBox1.Text == "" || this.dateTimePicker1.Text == "") { MessageBox.Show("please insert Data"); } else { AccountingR i = new AccountingR(); i.Date = this.dateTimePicker1.Value.ToShortDateString(); i.Money = Convert.ToDouble(this.textBox1.Text); AccountingRepository ar = new AccountingRepository(); if (ar.Update(i)) { List <AccountingR> allResult = ar.GetAllTransiction(); this.dataGrid1.DataSource = allResult; this.textBox1.Text = ""; this.dateTimePicker1.Text = ""; } else { MessageBox.Show("Can Not Update Transition", "Update Error"); } } }