private void btnSustraer_Click(object sender, EventArgs e) { frmJugador miFormulario = new frmJugador(); DialogResult rta = DialogResult.No; int index = lstJugadores.SelectedIndex; if (index > -1) { rta = MessageBox.Show("Realmente desea eliminar este jugador?" + "\n" + this._equipo.GetJugadores()[index].MostrarDatos(), "Borrado de jugador", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if ((this._equipo - this._equipo.GetJugadores()[index]) && (rta == DialogResult.Yes)) { MessageBox.Show("Jugador borrado"); this.Agregar(); } } }
private void btnModificar_Click(object sender, EventArgs e) { int index = lstJugadores.SelectedIndex; if (index > -1) { frmJugador Jugador = new frmJugador(this._equipo.GetJugadores()[index]); Jugador.ShowDialog(); if (Jugador.DialogResult == System.Windows.Forms.DialogResult.OK) { this._equipo.GetJugadores()[index] = Jugador.GetJugador(); MessageBox.Show("Jugador modificado con exito"); this.Agregar(); } } }
private void btnAgregar_Click(object sender, EventArgs e) { frmJugador miFormulario = new frmJugador(); miFormulario.ShowDialog(); if (miFormulario.DialogResult == System.Windows.Forms.DialogResult.OK) { if (this._equipo + miFormulario.GetJugador()) { MessageBox.Show("Se agrego exitosamente"); this.Agregar(); } else { MessageBox.Show("No se pudo agregar"); } } }