List Box / Combo Box

M

-Michelle-

This may be a silly question, but I need to know

I have a number of listboxes that i need to put on a form.

I would prefer to use combo boxes because they don't take up so much room,
but I need to be able to multiselect, hence using list boxes. (If I can
multiselect using comboboxes, I'll be happy to hear about it).

Is there a way that when the user put focus on the list box, the height of
the listbox will drop down, so that more than a single item can be seen, and
when the focus is lost again, reset the height back to a normal one item
height?

TIA
Michelle
 
D

Douglas J. Steele

You can put code in the listbox's GotFocus event to increase the control's
Height, and then decrease it again in the listbox's LostFocus event.

Private Sub lstNames_GotFocus()
Me.lstNames.Height = 960
End Sub

Private Sub lstNames_LostFocus()
Me.lstNames.Height = 240
End Sub

(And no, there's no way to multiselect using comboboxes)
 
M

-Michelle-

Thanks for your information Doug


Douglas J. Steele said:
You can put code in the listbox's GotFocus event to increase the control's
Height, and then decrease it again in the listbox's LostFocus event.

Private Sub lstNames_GotFocus()
Me.lstNames.Height = 960
End Sub

Private Sub lstNames_LostFocus()
Me.lstNames.Height = 240
End Sub

(And no, there's no way to multiselect using comboboxes)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top