Setting Multi-Select prop on ListBox 
Author Message
 Setting Multi-Select prop on ListBox

I am creating a ListBox via the Controls.Add method versus at design time.
This prevents the ability to set the Multi-Select property of the ListBox.
I'm guessing this property can still be set using the API however. Does
anyone know how?

Thanks in advance!

JR



Sat, 31 Jan 2004 09:03:50 GMT  
 Setting Multi-Select prop on ListBox
One way is to place one on your form at design time and set it's visible
property = False until you need it. Or.. if you'll need more than one, you
can place one on the form, visible = False, set its properties the way you
want and its Index property = 0, then use Load to load more. They'll
"inherit" most of their parents properties.. Not sure how much you know
about this stuff so here's an example (modified from a reply to a similar
question)

If lstHidden is an existing Listbox, just set it's Index property = 0 which
creates an array. Then use something like...
'===============
Private Sub cmdAddAnother_Click()
   Dim iNewOne As Integer
   iNewOne = lstHidden .UBound + 1
   Load lstHidden (iNewOne)
   With lstHidden (iNewOne)
      .Move WhereEver
      .Visible = True
   End With
End Sub

Private Sub lstHidden _Click(Index As Integer)
   'Note that each event handler now has
   'Index As Integer to let you know
   'which control raised the event
End Sub
'===============

Also note that if you already have code in some of the event handlers,
you'll need to add that "Index As Integer" param to those subs


Quote:
> I am creating a ListBox via the Controls.Add method versus at design time.
> This prevents the ability to set the Multi-Select property of the ListBox.
> I'm guessing this property can still be set using the API however. Does
> anyone know how?

> Thanks in advance!

> JR



Sat, 31 Jan 2004 11:53:21 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Multiselect listbox: How to SET selected item

2. How do I Neatly and Cleanly set Selected Property in Large ListBox (MultiSelect=Simple)

3. How do I Neatly and Cleanly set Selected Property in Large ListBox (MultiSelect=Simple)

4. How do I Neatly and Cleanly set Selected Property in Large ListBox (MultiSelect=Simple)

5. Selecting All Items In a MultiSelect ListBox

6. multi-select listbox

7. Newbie q: Remove selected items from multiselect listbox?

8. Listbox - multiselect : how to get selected items ?

9. FileListBox....Multi Select...to Listbox....8~ )

10. FileListBox....Multi Select....to ListBox..... 8~ )

11. ListBox - finding which items are selected with the MultiSelect Property

12. HELP: Multi-selected ListBox Drag-Drop!!

 

 
Powered by phpBB® Forum Software