Allow Combobox dropdown but NOT select an item

G

Guest

I want the user to be able to drop down the list in a combobox and the user
to scroll the list up and down but they can't pick an item in the list.

I have started looking at overriding the DefWndProc but not sure what
messages to capture.

Any help would be appreciated??
 
G

Guest

This is not what I want. If I use a DropDownList the user can change the
selectedvalue. I want the user to be able to drop down the list to see all
the values but they can't change or select a new value.

Essentially a readonly combobox
 
R

Ron

Sorry, Scott.
One way to do this is to use the SelectedIndexChanged event.
When you show your form, store the SelectedIndex in a variable.
In the SelectedIndexChanged event handler, set the SelectedIndex back to the
value of your variable.
Then whatever item the user clicks on, the result will always revert to your
saved index value.
I have tested that and it works for me. :)
You will also have to stop them typing a new value in the edit box part.

HTH
Ron.

Scott Wylie said:
This is not what I want. If I use a DropDownList the user can change the
selectedvalue. I want the user to be able to drop down the list to see all
the values but they can't change or select a new value.

Essentially a readonly combobox
<snip>
 
G

Guest

Scott,

Ron's suggestion about the SelectedIndexChanged event handler will work just
fine.

But, what I'm curious about is what is the reason that you want this
functionality? Just wondering ....

~~Bonnie
 
G

Guest

The main reason for this functionality is that users can't easily see the
value when the combo is disabled (default colors of grey on grey is tough for
people to see at a glance) and our users want to see all values in the list
which you can't when it is disabled.

The color part of the REadOnly property of the textbox is what users prefer
instead of disabled. It also allows them to select and copy where you can't
when it is disabled.
 
G

Guest

Oh, duh! My bad ... you did mention something about a "read-only" combobox in
your earlier post. Guess I missed that. Thanks for clarifying ... silly me. =)

~~Bonnie
 

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