Can you have a combo or drop-down box where the user can either choose from a list of given alternatives, or enter their own value?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, this is a feature of the standard
ComboBoxcontrol. Its precise behavior depends on the value you set for the control’sStyleproperty. Here’s a quick run-down of the options:vbComboDropDownis the default style. The combo box looks like a single-line text box with a drop-down arrow. The user can either type arbitrary text into the text box, or they can select one of the pre-defined options from the drop-down list.vbComboSimplegets you the old classic-style combo box. This is literally just a text box fused on top of a list box (and that’s how the combo box control got its name!). Like the default style, the user can either type arbitrary text into the text box at the top, or they can select one of the pre-defined options from the list box underneath.The only real difference between this style and the default style is that all of the available options are always visible on the screen. It takes up more screen real estate, but it makes it easier for the user to see exactly what their choices are.
vbComboDropDownListwill produce a combo box that looks very much like the first (default) style, except that the user will not be able to type arbitrary text into the text box. They can only choose one of the pre-defined options available in the drop-down list.As a supplement to my best-effort descriptions, you can also see Microsoft’s documentation for the Win32 Combo Box control, complete with screenshots. The VB 6 control is just a wrapper around the standard Win32 control, so everything you see there will be the same for a VB 6 application. The only difference is the names of the styles—instead of setting one of the
CBS_*flags, you use one of thevb*constants.In this case, it sounds like you want the first option,
vbComboDropDown.