Locked Property Bug in VS2008?

  • Thread starter Thread starter Ishmael
  • Start date Start date
I

Ishmael

I'm trying to set the Locked property of a ComboBox. In the Form
Designer, the property shows up, but when I run the code, it doesn't
do anything. Then I noticed that under the "Windows Form Designer
generated code" section, the property never gets set. Finally, I
tried to set the property programatically, but it isn't available (not
listed in the UI menu when I type this->ComboBox1->). I'm running
Visual Studio 2008, Version 9.0.20122.8

Any ideas?

Thanks for your help!
 
I'm trying to set the Locked property of a ComboBox. In the Form
Designer, the property shows up, but when I run the code, it doesn't
do anything. Then I noticed that under the "Windows Form Designer
generated code" section, the property never gets set. Finally, I
tried to set the property programatically, but it isn't available (not
listed in the UI menu when I type this->ComboBox1->). I'm running
Visual Studio 2008, Version 9.0.20122.8

Any ideas?

Thanks for your help!

If you look at the documentation for ComboBox, you will see that
Locked is not listed. Locked is not a property of the ComboBox class,
but is added to the Properties window by the IDE, so it is available
only in the Properties window at design time and not at runtime.

If you select the Locked property in the Properties window you will
see the description of the property at the bottom of the window says
"The Locked property determines if we can move or resize the control."
When you set Locked True, you will see that the control can no longer
be moved or resized in the IDE. Locked affects only the IDE.

The only built-in way to prevent a user from changing a ComboBox is to
set Enabled = False.
 
Thanks - that clears things up.
I actually figured out a workaround, which is simply to add a KeyPress
event handler to the ComboBox, then exit immediately by setting e-
 
Back
Top