//method to delete a Sag from DB private void btn_SletSag_Click(object sender, EventArgs e) { //Initializes SagBLL and SagDAL sag = new SagBLL(SagsID()); try { if (SagBLL.SagExists(SagsID())) { //delete a Sag from DB sag.SletSag(sag); } else { MessageBox.Show("Der findes ikke nogen bolig i database med dette ID. Prøv venligst med en anden ID."); } } catch (Exception ex) { MessageBox.Show(ex.Message); } //Loader data fra databasen ind i datagridview SagUI_Load(sender, e); //clear all TextBoxes ClearAll(); //disable all TextBoxes DisableAll(); //enable BoligID TextBox sagID_txt.Enabled = true; }