private void eliminarVotantesToolStripMenuItem1_Click(object sender, EventArgs e) { //metodo que elimina la fila seleccionada if (DialogResult.Yes == MessageBox.Show("Desea eliminar el registro seleccionado", "Eliminar", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { if (dtgVotantes.SelectedRows.Count > 0) { Votante votante = (Votante)dtgVotantes.SelectedRows[0].DataBoundItem; VotantesCL oVontantesCl = new VotantesCL(); oVontantesCl.EliminarVotantes(votante.Usuario); if (oVontantesCl.IsError) { MessageBox.Show(oVontantesCl.ErrorDescripcion, "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else { this.TraerDatos(); } } } this.TraerDatos(); }