-
Key down
Hi everyone
I have placed this code on the key down event of a combo box to prevent the ability to enter text but still use the drop down
if keycode <>9 then
keycode=0
end if
this works really well
i have hundreds of combo boxes in my application, is it possible to put this code in a module and then call that with the key down event instead? And would there be any advantage to doing this?
if so how could I do this
thanks in advance
steve
-
You could probably create one, though I'm not sure I'd bother. I'm curious why you care if they type? I'd just use the limit to list property to make sure they couldn't type something that didn't exist.
-
Hi pbaldy
thanks for the reply, I don't really mind if they type, it's just for me a case of personal preference.
i had limit to list set, but some of my users asked me if I could stop them typing in the combo list by mistake.
to be honest it's not much code to copy into the keydown event of each combo box so I think I may just do that
Steve
-
You could set its Tab Stop to no, then they won't inadvertently get into the field without clicking.
-
Hi aytee111
thanks for the reply, good catch I will make sure I set that, I think I have missed a few tbh
Steve
-
I hope these Comboboxes don't contain many selections! If users can't enter characters...the Auto Expand won't work! With Auto Expand, as you start typing characters into the Combobox, it moves to selections that match what has been typed, and prevents having to scroll down thru however many selections there are to get to the desired one.
Linq ;0)>
-
Hi Missinglinq
luckily the vast majority of the combo boxes only have very few selections, on the ones that have lots im not going to implement this
thanks for the catch mate 
Steve
-
If you want to use a function, it wouldn't be hard. Your combo code would look like:
keycode=FunctionName(keycode)
and the function would do your logic and pass back the appropriate value.
-
Hi Pbaldy
I'm really sorry for the late reply, i have only just seen this
that is fantastic many many thanks for the heads up
that's just what i was after
Steve
-
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