private void btnDelete_Click(object sender, EventArgs e) { var conf = MessageBox.Show("Are you sure?", "Delete Item", MessageBoxButtons.YesNo); if (conf != DialogResult.Yes) { return; } ReportMetadata rmd = new ReportMetadata(); rmd.UID = Convert.ToInt32(txtUID.Text); bool ret = rmd.Delete(); if (ret) { MessageBox.Show("Item Deleted Successfully."); } else { MessageBox.Show("Deletion was unsuccessful."); } if (uiReportMetadata != null) { uiReportMetadata.loadMetadataList(rmd.UID); } this.Visible = false; }
// // Double click on client metadata list // The idea is to remove the metadata // private void dgvClientMetadata_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { // This is the double-click on the available list // // Get selected row if (dgvClientMetadata.SelectedRows.Count <= 0) { return; } var selectedRow = dgvClientMetadata.SelectedRows; ReportMetadata rm = new ReportMetadata(); ConvertSelectedRow(rm, selectedRow[0]); // Insert into db with client id rm.Delete(); // Reload lists // loadList(); }