Exemplo n.º 1
0
        private void button8_Click(object sender, EventArgs e)
        {
            Stagiaire S1;

            if (radioButton1.Checked)
            {
                S1 = new Stagiaire(textBox1.Text, textBox2.Text, "M",
                                   comboBox1.SelectedItem.ToString(), int.Parse(numericUpDown1.Value.ToString()));
            }
            else
            {
                S1 = new Stagiaire(textBox1.Text, textBox2.Text, "F",
                                   comboBox1.SelectedItem.ToString(), int.Parse(numericUpDown1.Value.ToString()));
            }
            LesStagiaires.Add(S1);

            /////////////////////////////////////////////////
            String[] row = new String[5];
            row[0] = textBox1.Text;
            row[1] = textBox2.Text;
            if (radioButton1.Checked)
            {
                row[2] = "M";
            }
            else
            {
                row[2] = "F";
            }
            row[3] = comboBox1.SelectedItem.ToString();
            row[4] = numericUpDown1.Value.ToString();
            this.dataGridView1.Rows.Add(row);
        }
Exemplo n.º 2
0
        private void button11_Click(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear(); //pour supprimer dataGridView1

            int       i; string[] row = new string[5];
            Stagiaire S1 = new Stagiaire();

            for (i = 0; i < LesStagiaires.Count; i++)
            {
                S1 = (Stagiaire)LesStagiaires[i];
                if (S1.Option == comboBox1.SelectedItem.ToString())
                {
                    row[0] = S1.Nom;
                    row[1] = S1.Prénom;
                    row[2] = S1.Sexe;
                    row[3] = S1.Option;
                    row[4] = (S1.Age).ToString();
                    this.dataGridView1.Rows.Add(row);
                }
            }
        }
Exemplo n.º 3
0
 private void button9_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count == 0)
     {
         label10.Text = "Erreur de Selection";
     }
     else
     {
         if (MessageBox.Show("Voulez vous vraiment supprimer ?", "Attention", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             label10.Text = "";
             //////////// Memoire /////////////////////
             Stagiaire S1;
             S1 = new Stagiaire(dataGridView1.SelectedRows[0].Cells[0].Value.ToString(),
                                dataGridView1.SelectedRows[0].Cells[1].Value.ToString(),
                                dataGridView1.SelectedRows[0].Cells[2].Value.ToString(),
                                dataGridView1.SelectedRows[0].Cells[3].Value.ToString(),
                                int.Parse(dataGridView1.SelectedRows[0].Cells[4].Value.ToString()));
             LesStagiaires.Remove(S1);
             ///////////////////: affichage //////////////::
             dataGridView1.Rows.Remove(dataGridView1.SelectedRows[0]);
         }
     }
 }