private void btnmodanimal_Click(object sender, EventArgs e) { animal Animal = new animal(); if (selection() != null) { MessageBox.Show(selection(), "selectionner", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { Forms.Add_edit_animal frmanimal = new Forms.Add_edit_animal(this); frmanimal.titreanimal.Text = "Modifier Animal"; for (int i = 0; i < gridanimal.Rows.Count; i++) { //si la ligne est selectionné if ((bool)gridanimal.Rows[i].Cells[0].Value == true) { if (Animal != null) { frmanimal.ID_animal = (int)gridanimal.Rows[i].Cells[1].Value; frmanimal.txtnoma.Text = gridanimal.Rows[i].Cells[2].Value.ToString(); frmanimal.txtquantité.Text = gridanimal.Rows[i].Cells[3].Value.ToString(); frmanimal.txttype.Text = gridanimal.Rows[i].Cells[4].Value.ToString(); frmanimal.txtsexea.Text = gridanimal.Rows[i].Cells[5].Value.ToString(); frmanimal.combocategoriey.Text = gridanimal.Rows[i].Cells[6].Value.ToString(); } } } frmanimal.ShowDialog(); } }
private void btnaddclient_Click(object sender, EventArgs e) { Forms.Add_edit_animal frmanimal = new Forms.Add_edit_animal(this); frmanimal.ShowDialog(); }