protected void botonBaja_Click_1(object sender, EventArgs e) { if (tablaListado.SelectedRows.Count == 1 && tablaListado.RowCount != 0) { DataGridViewRow row = this.tablaListado.SelectedRows[0]; int id = Convert.ToInt32(row.Cells["id"].Value); if (Convert.ToBoolean(row.Cells["activo"].Value) == true) { if (AutomovilDAO.deleteAutomovil(id) == 1) { MessageBox.Show("Automovil dado de baja correctamente"); cargarDGVAutomovil(); } } else { MessageBox.Show("El automovil ya esta deshabilitado"); } } }