Preventing user from typing into a combo box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi.

one of the annoying problem i have encountered using the combo box is its
property of allowing users to type into the box. once typed, the value set by
the user is rendered instead of the original value and i have to write more
code to eliminate such entries.

is there a way to make the combo box 'ReadOnly' so that i can save myself
some time? i have scanned through the properties window as well as the
doucmentation and nothing seems to be related with this issue.

thanks.
 
Xero,

Change the combobox's DropdownStyle to DropdownList.

Kerry Moorman
 
Xero wrote:
[snip]
is there a way to make the combo box 'ReadOnly' so that i can save myself
some time? i have scanned through the properties window as well as the
doucmentation and nothing seems to be related with this issue.

If you mean: You will load up the Items collection with the valid
choices, and you want the user to be able to select one of those, but
not be able to enter a new one, then Yes! Just set the combo's
DropDownStyle property to DropDownStyle.DropDownList and the behavior
will be:

"The user cannot directly edit the text portion. The user must click
the arrow button to display the list portion."
 
Xero said:
one of the annoying problem i have encountered using the combo box is its
property of allowing users to type into the box. once typed, the value set
by
the user is rendered instead of the original value and i have to write
more
code to eliminate such entries.

Set the control's 'DropDownStyle' property to 'DropDownList'.
 
In the spirit of repetition, change the DropDownStyle property to
DropDownList.
 

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

Back
Top