private void button1_Click(object sender, EventArgs e) { bool flag = false; int indice = this.txtListBox.SelectedIndex; if (indice > -1) { List <Jugador> list = this._equipo.GetJugadores(); DialogResult devuelve = MessageBox.Show("Desea Modificar el siguiente jugador : " + list[indice].MostrarDatos(), "Mensaje", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (devuelve == DialogResult.OK) { FrmJugador miFormulario = new FrmJugador(list[indice]); miFormulario.ShowDialog(); } } }
private void btnMas_Click(object sender, EventArgs e) { FrmJugador miFormulario = new FrmJugador(); miFormulario.ShowDialog(); if (miFormulario.DialogResult == System.Windows.Forms.DialogResult.OK) { jug = miFormulario.getJugador(); flag = this._equipo + jug; if (flag) { MessageBox.Show("Lo agrego correctamente"); this.AgregarYMostrar(); } else { MessageBox.Show("No lo pudo agregar"); } } }