Click to See Complete Forum and Search --> : vb6 list box
Dave Dutke
Apr 6th, 2002, 07:44 AM
I need to select multiple items in a list box at run-time from code so that my form wakes up with several items in a list box already selected.. The problem is that the list text property only works if multi-select is set to "none" and then of course only selects one item in the list box.
Thanks!
DerFarm
Apr 11th, 2002, 10:36 AM
If I'm understanding you correctly, the following function will
return a delimited string containg the selected list items. The
delimiter = "^"
Function SelectedList(List1 as listbox) as string
Dim I as integer
Dim Ret_Val as string
Ret_Val = ""
For I = 0 To List1.ListCount - 1
If List1.Selected(I) Then
Ret_val = Ret_val & "^" & List1.List(I)
End If
Next I
Xit_SelectedList:
SelectedList=Ret_Val
End Function
HTH
Penavin
Apr 12th, 2002, 04:01 AM
Do you want to see open list box with some (but not all) of available items selected? Must selection be contiguous?
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.