-
Nov 8th, 2007, 04:07 AM
#1
Thread Starter
Hyperactive Member
[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
-
Nov 8th, 2007, 04:21 AM
#2
Frenzied Member
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
-
Nov 8th, 2007, 04:23 AM
#3
Thread Starter
Hyperactive Member
Re: Don't let the user type in a ComboBox
-
Nov 8th, 2007, 04:25 AM
#4
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.
-
Nov 8th, 2007, 04:30 AM
#5
Thread Starter
Hyperactive Member
Re: [RESOLVED] Don't let the user type in a ComboBox
-
Nov 8th, 2007, 07:52 AM
#6
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.
-
Nov 8th, 2007, 06:58 PM
#7
Thread Starter
Hyperactive Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|