private void btnBorrar_Click(object sender, EventArgs e) { if (PersonaDAO.Borrar(((Persona)listBox1.SelectedItem).ID) == false) { MessageBox.Show("Error", "No se pudo borrar en la base", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnEliminar_Click(object sender, EventArgs e) { PersonaDAO.Borrar(this.idSeleccionado); MessageBox.Show($"Se Elimino {this.txtNombre.Text}, {this.txtApellido.Text} de la BD", "Borrar", MessageBoxButtons.OK, MessageBoxIcon.Information); this.lstPersonas.Items.Clear(); this.txtApellido.Text = string.Empty; this.txtNombre.Text = string.Empty; this.btnLeer_Click(sender, e); }
private void btnBorrar_Click(object sender, EventArgs e) { try { Persona auxPersona = (Persona)listBoxLectura.SelectedItem; if (!(auxPersona is null) && basePersonas.Borrar(auxPersona.Id)) { btnLeer_Click(sender, e); MessageBox.Show("Se elimino la persona!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }