ReadOnly ComboBox

G

Guest

Is there an easy (i.e. without creating a new control) way to make a ComboBox
ReadOnly such that the user can't change its value but doesn't have to strain
their eyes to read its greyed out text?
 
F

Floyd Burger

set the DropDownStyle to DropDownList. That will only let you select one of
the items that is in the list.
 
J

Jeffrey Tan[MSFT]

Hi Richard,

Thanks for your post!!

If you want to prevent the user from modifying item in the "textbox" of
combobox and still want the dropdown behavior, you may follow Floyd's
suggestion of changing combobox's style from DropDownStyle to
DropDownList.

If you want to disable both content modify and dropdown behavior, I think
you may use a readonly textbox to replace combobox control.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
C

Claudio Grazioli

Is there an easy (i.e. without creating a new control) way to make a ComboBox
ReadOnly such that the user can't change its value but doesn't have to strain
their eyes to read its greyed out text?

Dick,

As Jeffrey suggests, you may use a ReadOnly textbox control, while
ReadOnly. If you want to go this way, you can use my own ReadOnlyComboBox
which encapsulates that behavior. It has a ReadOnly property and as soon as
you set it to true, it displays a ReadOnly texbox instead of the combobox.
When you set it back to false, it displays again the ComboBox.

You can download it from my blog:
http://www.grazioli.ch/Blog/PermaLink.aspx?guid=696e467f-5f8c-40f2-8270-62e4cd3b7281

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top