jeudi 9 février 2017

"if" that doesn't work perfectly

what wrong with this code? Either combobox is "Wholesale" or "Retail" the form show the second statement (true, true). If I untick the checkbox the else works (true,false). Any idea why?

private void checkBox3_CheckedChanged(object sender, EventArgs e)
    {
        if (checkBox3.Checked == true || comboBox1.SelectedText == "Standalone")
        {

            this.checkBox1.BackColor = Color.Gray;
            this.checkBox1.Enabled = false;
            this.checkBox2.BackColor = Color.Gray;
            this.checkBox2.Enabled = false;
        }
        if (checkBox3.Checked == true || comboBox1.SelectedText == "Retail")
        {
            this.checkBox1.BackColor = default(Color);
            this.checkBox1.Enabled = true;
            this.checkBox2.BackColor = default(Color);
            this.checkBox2.Enabled = true;
       }
      Else
      {
            this.checkBox1.BackColor = default(Color);
            this.checkBox1.Enabled = true;
            this.checkBox2.BackColor = Color.Gray
            this.checkBox2.Enabled = false;
      }

Aucun commentaire:

Enregistrer un commentaire