void Save() { dataEntities db = new dataEntities(); not noe = new not(); noe.note = this.txtnote.Text; db.nots.Add(noe); db.SaveChanges(); this.Close(); MessageBox.Show("successfully!"); }
void delete() { if (listview.SelectedRows.Count == 1) { var row = listview.SelectedRows[0]; string cell = (string)row.Cells["note"].Value; dataEntities db = new dataEntities(); not noe = db.nots.Single(st => st.note == cell); db.nots.Remove(noe); db.SaveChanges(); this.load(); } }