private void addTeamToolStripMenuItem_Click(object sender, EventArgs e) { AddTeamForm atf = new AddTeamForm(); atf.MdiParent = this;//on a effectué le lien entre les deux formes atf.Show(); }
private void bt_ModifyTeam_Click(object sender, EventArgs e) { try { int index = dataGridView1.CurrentRow.Index; if (index == -1) { throw new Exception("You should select a line on the datagrid to update it"); } ; int id = (int)dataGridView1[0, index].Value; Team team = getAllTeams().Find(x => x.Id == id); AddTeamForm adf = new AddTeamForm(team, dataGridView1); adf.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } }
private void bt_AddTeam_Click(object sender, EventArgs e) { AddTeamForm atf = new AddTeamForm(dataGridView1); atf.Show(); }