예제 #1
0
파일: Form1.cs 프로젝트: zaineb88/TDI1
        private void button1_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);
            //comboBox1.Items.Add(textBox3.Text);*
            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);
        }
예제 #2
0
파일: Form1.cs 프로젝트: zaineb88/TDI1
        private void button3_Click(object sender, EventArgs e)
        {
            //comboBox1.Items.Remove(textBox3.Text);
            // textBox3.Text = "";
            Stagiaire s1 = new Stagiaire();

            if (dataGridView1.SelectedRows.Count == 0)
            {
                label9.Text = "Erreur de selection";
            }
            else
            {
                label9.Text = " ";
                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[2].Value.ToString(),
                    dataGridView1.SelectedRows[0].Cells[3].Value.ToString(),
                    int.Parse(dataGridView1.SelectedRows[0].Cells[4].Value.ToString()));
                LesStagiaires.Remove(s1);
                dataGridView1.Rows.Remove(dataGridView1.SelectedRows[0]);
            }
        }