Forum Home
Press F1
 
Thread ID: 68622 2006-05-05 12:25:00 VB6 form with combo box andrew93 (249) Press F1
Post ID Timestamp Content User
452404 2006-05-05 12:25:00 Hi

A couple of questions about combo / drop down boxes on forms in Visual Basic 6.

Can you set the number of items shown in the combo box when it is clicked? The default value is 8 and I can't work out where / how I change this value. If I want to display say 15 items when the box is clicked, how do I do that?

Secondly, is there something like an auto-fill option on combo boxes? What I would like to see is that if the user types the first few letters of an item in the list, then the list selector jumps to that item - exactly like they do in the combo boxes on forms in Access. Can that be done?

Thanks in advance
Andrew
andrew93 (249)
452405 2006-05-06 22:18:00 Bump.

Anyone?
andrew93 (249)
452406 2006-05-07 07:41:00 I don't think you can change the length of the drop-down box when it is clicked. However, you could change Style property to 1 (vbComboSimple), which permanently displays the list items. You also need to draw the combobox in the IDE long enough to display 15 items, or use the Height property to set the height at run-time.

I think the auto-fill option happens by default, but remember that with a combobox the user can type whatever they want in the field. You can restrict this by using Style 2 (vbComboDrop-DownList) but lose the ability to display a specific number of items.
Antmannz (6583)
452407 2006-05-07 10:14:00 Hi Andrew, do you have a MaxDropDownItems property for the combo? Set this to the value you require.

cheers,
Graham
Parry (5696)
452408 2006-05-08 10:05:00 Thanks for the replies.

I can't see a property 'MaxDropDownItems' - is just for VBA Graham? It doesn't appear as an option in VB6.

I used 15 as an example, because I have a number of combo boxes with varying numbers of items. But thanks for the suggestion Antmannz. Regarding the auto-fill, if I first click the combo box then start typing, it selects a value when I tab off the combo box (not before). If I don't first click the combo box, then it doesn't select the item I start typing at all. I may have to revert to some code to force it to select the first matching item in the list......

Cheers, Andrew
andrew93 (249)
452409 2006-05-08 20:11:00 Hi Andrew it was in VBNet. I dont know my way around at all but when I run the combo that property appeared although I didnt notice it before I ran the form. Parry (5696)
452410 2006-05-08 21:25:00 If you do a VB List Properties of the Combobox you can edit the ListRows property from the default of 8 to the number required. rad_s4 (7401)
452411 2006-05-08 21:27:00 Hi Graham
Are you using Vb dot net? I heard the code in dot net projects can be decompiled. I started a thread on this at the forums at vbaexpress.com some time ago. I've tried using it but prefer VB6 - even with limited functionality on things like combo boxes.
Cheers, Andrew
andrew93 (249)
452412 2006-05-08 21:34:00 Thanks for the suggestion rad_s4

Where do I find this property? It's not a property on the combo box, nor the form and I can't set the option on form load because it is not an option when I enter a command like :

Me.Combo1.List....?

Any pointers as to where to find this?

Thanks
Andrew
andrew93 (249)
452413 2006-05-09 00:03:00 I have assumed this is in Excel ? rad_s4 (7401)
1 2