Combo Box

KenHigg

Registered User
Local time
Yesterday, 21:13
Joined
Jun 9, 2004
Messages
13,289
I have a combo box and I don't want the user to be able to type ANYTHING in the list but just be able to select one of the options. I know I can limit to list but this doesn't give the desired result. I still lets the user type in the control then simply tells them after the fact that the value they've typed is not on the list.

Any ideas? I've also tinkered with the enabled and locked attributes and they don't seem to be any help - ?
 
I dont think that is possible?
Perhaps if you lock it?
Or perhaps if you use the "On Key" event to delete any data entry done into the field directly??

But I dont think it is possible as a direct option..
 
I also can't think of a built-in functionality that would let you do that.

But we can work around that, definitely.

Two possible option:

1) Use a listbox instead. I'm assuming this is no-go as you want the dropdown thingy.

2) Place a textbox on top of the combobox and lock & disable the textbox. Have the Textbox display the value of combobox. The textbox should be just a bit shorter than the combobox so user still can click on the dropdown button. I'm not sure it'll work without the combobox getting in front of the textbox when selected, though. Couldn't hurt to try that.
 
Thanks - I'll look into those options :)
 
I always create an unbound text field (fldHidden) on the form and set it to the smallest dimensions so that it is basically invisible.

Then in the ON Key Press event of the combobox I put: Me.fldHidden.SetFocus

That prevents any typing in the combobox.

Catalina
 
Last edited:
Thanks Catalina, I may try that. :)
 
Glad to help.

I use the same method anytime I want to hide the cursor
and I always put it in the After Update event of a combobox.

Catalina
 
i've used various key events and the hidden txtbox trick (a la banana's post) in the past. i think the txtbox is more work (?) but effective.

i format textboxes to shades of grey when they need to be/look disabled. don't know offhand if that'll work with a dropdown.
 

Users who are viewing this thread

Back
Top Bottom