private void button1_Click(object sender, EventArgs e) { fiche_Rubriquecs f = new fiche_Rubriquecs(); f.id = 0; f.ShowDialog(); }
private void button2_Click(object sender, EventArgs e) { string[] tab = new string[11]; int i = 0; foreach (DataGridViewCell cell in dataGridView1.SelectedCells) { if (cell.Value == null) { tab[i] = ""; } else { tab[i] = cell.Value.ToString(); } i++; } int x; if (tab[9] != null) { fiche_Rubriquecs f = new fiche_Rubriquecs(); try { f.id = Int32.Parse(tab[9]); } catch (Exception) { } foreach (var item in list_rub.ToList()) { if (Int32.Parse(tab[9]) == item.id_rubrique) { f.Rub = item; } } f.ShowDialog(); } }