private void DeleteKaryawan(string id) { if (id == "") { MessageBox.Show("Pilih data yang ingin dihapus!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (MessageBox.Show(this, "Are you sure want to delete Karyawan " + textBox1.Text + " ?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { var t = (from a in db.db_Karyawan.ToList() where a.ID_Karyawan == id select a).First(); db.DeleteObject(t); db.SaveChanges(); } }