Roman F
asked on
VB 6 combo box problem
I have a combo box, let called it ZipCode
So, you have to select the appropriate zip code selecting from the combo box
Right now you can just type in the field instead of selecting.
How to prevent the user from typing anything in the combo box and make sure that the only way to select the value is to select from the combo box
So, you have to select the appropriate zip code selecting from the combo box
Right now you can just type in the field instead of selecting.
How to prevent the user from typing anything in the combo box and make sure that the only way to select the value is to select from the combo box
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What do you mean by "validate through the code"?
Combo1.Style = 0
Combo1.Style = 0
ASKER
no, like something preventing the user type in, using let say If statements...
You said: >How to prevent the user from typing anything in the combo box and make sure that the only way to select the value is to select from the combo box<
But to set the style to 0, you allow user to type into the combo box. Is this what you want?
But to set the style to 0, you allow user to type into the combo box. Is this what you want?
ASKER
I know that...
but for what ever reason i am getting the error, when i am changing the style =2...
but for what ever reason i am getting the error, when i am changing the style =2...
Try this:
Private Sub Combo1_KeyPress(KeyAscii As Integer)
KeyAscii = 0
End Sub
If your style is 2 then when they user types 3 it would find the first zip code beginning with 3
what are you trying to allow the user to have with style 0 that they would loose with style 2?
what are you trying to allow the user to have with style 0 that they would loose with style 2?
What error are you getting?
The most common is that you are attempting to set the combo box equal to a value that is NOT in the list of items
Example...
box populated with
30012
30014
30016
your recordset has a value of 30015
and you set datasource to recordset
In order to overcome this you must make sure the data matches the available list.
The most common is that you are attempting to set the combo box equal to a value that is NOT in the list of items
Example...
box populated with
30012
30014
30016
your recordset has a value of 30015
and you set datasource to recordset
In order to overcome this you must make sure the data matches the available list.
@Brook1966, by setting the style to 2, the control does not respond to any key event.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I need my style=0