private void button3_Click(object sender, EventArgs e) { ImageDAO imageDAO = new ImageDAO(); CodeDAO codeDAO = new CodeDAO(); SourceControlDAO sourceControl = new SourceControlDAO(); BugDAO bugDAO = new BugDAO(); DialogResult dr = MessageBox.Show("Are you sure want to delete this bug?", "Are you sure", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information); if (dr == DialogResult.Yes) { try { codeDAO.Delete(bugId); imageDAO.Delete(bugId); bugDAO.Delete(bugId); sourceControl.Delete(bugId); MessageBox.Show("Deleted"); this.Dispose(); new Bugs().Show(); } catch (Exception ex) { Console.WriteLine(ex.Message); } } }