private void btnDeleteApplication_Click(object sender, EventArgs e) { if (dgvApplications.Rows.Count > 0) { int CountryId = Convert.ToInt32(dgvApplications.CurrentRow.Cells[0].Value.ToString()); string CountryName = dgvApplications.CurrentRow.Cells[1].Value.ToString(); if (MessageBox.Show("Are you sure you want to delete the Application " + CountryName + "?", "Delete Application", MessageBoxButtons.YesNo) == DialogResult.Yes) { App app = new App(); app.ApplicationId = Convert.ToInt32(dgvApplications.CurrentRow.Cells[0].Value.ToString()); app.ApplicationName = dgvApplications.CurrentRow.Cells[1].Value.ToString(); DALHelpers.DeleteApplication(CountryId); ActivityLog.ApplicationLogger(app, "DELETE", "", Environment.UserName); Validation.LocalDatabaseConfig(true); //databaseViewModel = Services.GetDataFromDatabase(); loadApplications(); } dgvApplications.ClearSelection(); txtSearchApplication.Clear(); btnEditApplication.Enabled = false; btnDeleteApplication.Enabled = false; } }