Combobox

There does not appear to be a "Locked" property for this component. When I type "dot", the intellisense does not show this property.

Please advise.
 
I have found that the Locked property is only available at design time and is only for keeping the control from moving.
 
Maybe a simply method, but it'll work:

ComboBox1.BackColor = Color.White
ComboBox1.Enabled = False

The combobox is disabled, but only the drop down arrow is gray. The combobox's paint event can fix that though.

Hope that'll help
Dan
 
DiverDan - the combobox still has the graying problem, even with this idea, in that the text is still grayed and setting it to black does not override this.
 
Is this a dynamically enabled/disabled control? If it's never enabled, why use a combobox at all? If it toggles, I'd think you'd want it to look disabled to give the user a visual cue that it can't be changed. Otherwise, if I see a combobox with an enabled look but it doesn't dropdown, I'm going to report it as a bug! (Better not let me be one of your testers!)

-Ner
 
As Nerseus stated, I've also allowed the gray text color to show its disabled. I think its too confusing to the user if there is no indication that something has changed.

Other than that you'll probably have to draw the text and arrow manually with the WndProc Overrides event. I think the m.Msg for a combo box is &HF.

Dan
 
The existing application has this behavior. It is currently in use, as is, and the billion dollar business that the applicaion supports, and it's users are quite happy with the way the application behaves. As to wheither or not this gui decision is agreeable to Nerseus, DiverDan, or whoever reads this is not at all the issue.

The solution to a problem of "don't do that" is sidestepping the question and imposing your own requirement.

This question is prompted by having begun the process of porting the application to vb.net, nothing more than that.
 
Well if that's what the users have then maybe it's best not to change it, though I might still push to have it either work as "expected" (and that's not just me, that's a Windows standard) or use a different control (such as a Label) to display the value.

I see no way of overriding the background and text colors through standard properties. You may have to do it through custom drawing or using the Windows API - sorry, no help on this one though. You might try an alternative such as only filling the combo with the one value that's in it. Along with setting the DropDownStyle to list and maybe handling the DropDown event to close it back up (to make it look like it can't be dropped down), you might get closer to what's currently being used.

As a last ditch effort, you *could* use the ActiveX control from the VB project though I wouldn't do that unless you absolutely had to. This assumes the old project was using such a control and that it would in .NET.

-Nerseus
 
Back
Top