-
FileListBox
I have setup a filelistbox that allows multiple selections. How do I view each selection in the code (i.e. File1.FileName just shows me the last selection, I want all selected items. File1.Selected (#) just tells me if that number was selected.) I assume I could write a for loop that checks if each item was selected and stick the results in an array, but I figure there has to be an easier way.
Thanks,
Quad
-
Re: FileListBox
Isn't that easy enough? :)
-
Re: FileListBox
If that is the only option, but I hate to do excess processing when it could be a property array of the component.
-
Re: FileListBox
From msdn:
Private Sub Form_Load ()
Dim I ' Declare variable.
' Fill the list box with screen font names.
For I = 0 To Screen.FontCount - 1
List1.AddItem Screen.Fonts(I)
Next I
End Sub
Private Sub Command1_Click ()
Dim I ' Declare variable.
' Clear all items from the list.
List2.Clear
' If an item is selected, add it to List2.
For I = 0 To List1.ListCount - 1
If List1.Selected(I) Then
List2.AddItem List1.List(I)
End If
Next I
End Sub
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
-
Re: FileListBox
Nope, that is the easiest way and the only way :)
-Cool Bizs