[RESOLVED] Don't let the user type in a ComboBox
They should only be able to click the combo to get the options, not type their own entry in.
I've tried .locked and that stops the user from selecting anything, while .enabled obviously just greys it out completely.
I thought of using the combo's change event to check if the user changed it to something that doesn't match any of the proper options, but that's probably a pretty dirty way of doing it.
cheers,
metal
Re: Don't let the user type in a ComboBox
Do you want to disbale all the key pressing? If so, use the keypress event.
EG:
Code:
Private Sub Combo1_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
:wave:
Re: Don't let the user type in a ComboBox
Re: [RESOLVED] Don't let the user type in a ComboBox
in addition to ZeeZee's suggession,
i thing if you put the combobox
Code:
Me.Combo1.Style = 2
would also work.
Re: [RESOLVED] Don't let the user type in a ComboBox
Re: [RESOLVED] Don't let the user type in a ComboBox
I prefer zeezee's method. When you change the style it removes the text property. However, disabling keypress has the same effect, but leaves the text property of the combo for use in code.
Re: [RESOLVED] Don't let the user type in a ComboBox
Yeah, I see what you mean, but for this particular instance Fazi's is better. I'll definitely remember zeezee's for the future though. That would come in handy for validation in textboxes. ie if keyascii = somebadcharacter then keyascii = 0