kunfuzed1
09-02-2003, 04:42 PM
I'm surprised i couldnt find the answer to this in the forum. Maybe i'm searching wrong..
But I'd like to know what I need to do to get a combo box to automatically fill in as you press keys.. such as
If i have a combo box with AM and PM in it, if i press A, I want it to go to AM if I press P, it brings in PM for me..
Is there a property to set I'm overlooking? i know it's got to be a really simple thing, but I can't seem to find it.
Thanks.
MikeJ
09-02-2003, 04:49 PM
Look into the ComboBox's KeyDown property:
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
Combo1.Text = ""
If KeyCode = vbKeyA Then 'checks for the letter A
Combo1.Text = "M"
ElseIf KeyCode = vbKeyP Then 'checks for the letter P
Combo1.Text = "M"
End If
End Sub
~Mike
kunfuzed1
09-02-2003, 04:54 PM
Look into the ComboBox's KeyDown property:
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
Combo1.Text = ""
If KeyCode = vbKeyA Then 'checks for the letter A
Combo1.Text = "M"
ElseIf KeyCode = vbKeyP Then 'checks for the letter P
Combo1.Text = "M"
End If
End Sub
~Mike
I appriciate the reply, and that will work for this particular instance because it's so small, but I was kind of hoping to just tuck this answer away for later date cuz I know I'm going to have another similar project coming up but with all the states in it. Alabama, Minnesota, Wisconsin, Etc. I know there is a way that it will bring you to the A states or M states just by pressing the first letter and it will cycle through them as you keep hitting that letter. That is more or less what I'm looking for.
I'm sorry I wasn't more specific.
reboot
09-02-2003, 04:56 PM
Did you look in our code library?
http://www.visualbasicforum.com/t90541.html
kunfuzed1
09-02-2003, 04:59 PM
Thanks Mike, much apprciated...
and
No reboot, I didn't look there, i just searched this forum for it.
But thanks, i will make sure to include that in my future searches for stuff.