Bonjour,
je veux faire une condition qui comporte un checkbox, mais malheureusement sa fonctionne pas :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
 
private void comboBox1_MouseDown(object sender, MouseEventArgs e)
        {
            if (checkBox1.Checked)
            {
                this.oleDbDataAdapter1.SelectCommand.CommandText = "SELECT * FROM CONT  ";
                dataSet1.Clear();
                oleDbDataAdapter1.Fill(this.dataSet1.Tables["CONT"]).ToString();
                string s = (string)dataSet1.Tables["CONT"].Rows[0]["CONT"];
            }
            else if (!checkBox1.Checked)
            {
                this.oleDbDataAdapter1.SelectCommand.CommandText = "SELECT * FROM CONT where (year(DATE_FIN)>=2008) ";
                dataSet1.Clear();
                oleDbDataAdapter1.Fill(this.dataSet1.Tables["CONT"]).ToString();
                string s = (string)dataSet1.Tables["CONT"].Rows[0]["CONT"];
            }
 
 
            this.comboBox1.DataSource = this.dataSet1;
            this.comboBox1.DisplayMember = "CONT.CONT";
            this.comboBox1.ValueMember = "CONT.CONT";
        }
toujour il entre dans le 1er if, quelque soit l'etat du checkbox, coché ou non, merci infiniment.