locked
Combobox.Enabled does nothing RRS feed

  • Question

  • .Net 2.0, VS 2005. Winforms. Combox.enabled has no effect. I set it to false and the combobox is still enabled and usable. Unacceptable.
    Thursday, June 16, 2011 3:41 PM

Answers

  • How did you create a new instance of comboBox? You have simple added it in a VS designer from Tollbox to a form?

    But it actually does not matter.

    Lets say the variable name of ComboBox class is "comboBox1".

    To disable it you can do:

    this.comboBox1.Enabled = false; //this keyword refers to the instance of the created ComboBox in Form1.
    

    This works. I dont know what you did, but this must work.


    Mitja
    • Marked as answer by lucy-liu Monday, June 27, 2011 9:06 AM
    Thursday, June 16, 2011 3:49 PM
  • I can assure you, Combobox.Enabled does work in .Net 2.0. There is more to the problem - the Enabled property is being flipped somewhere else, or you're setting enabled on the wrong object, or something similar. It's hard to know without more information, but the property itself definitely does work.
    • Marked as answer by lucy-liu Monday, June 27, 2011 9:06 AM
    Thursday, June 16, 2011 4:35 PM

All replies

  • How did you create a new instance of comboBox? You have simple added it in a VS designer from Tollbox to a form?

    But it actually does not matter.

    Lets say the variable name of ComboBox class is "comboBox1".

    To disable it you can do:

    this.comboBox1.Enabled = false; //this keyword refers to the instance of the created ComboBox in Form1.
    

    This works. I dont know what you did, but this must work.


    Mitja
    • Marked as answer by lucy-liu Monday, June 27, 2011 9:06 AM
    Thursday, June 16, 2011 3:49 PM
  • I can assure you, Combobox.Enabled does work in .Net 2.0. There is more to the problem - the Enabled property is being flipped somewhere else, or you're setting enabled on the wrong object, or something similar. It's hard to know without more information, but the property itself definitely does work.
    • Marked as answer by lucy-liu Monday, June 27, 2011 9:06 AM
    Thursday, June 16, 2011 4:35 PM