Adding multiple items from File Box to List box 
Author Message
 Adding multiple items from File Box to List box

I have had one heck of a time figuring out the logic for selecting multiple
files from a File List box and adding them to a regular list box.
I can add one at a time, but not multiple files

I use this code:
For i = 0 To File1.ListCount - 1
If Right(Dir1.Path, 2) = ":\" Then
        x = Dir1.Path & File1.List(i)
Else
    x = Dir1.Path & "\" & File1.List(i)
End If
List1.AddItem x
Next

That adds one at a time just perfectly.
I've tried:
Dim I
    For I = 0 To file1.ListCount - 1
        If file1.Selected(I) Then
            list1.additem file1.selected(i)
        End If
    Next I
(among many other iterations) - but just can't figure it out...
Can someone give me a little help here?
--
David Wier
http://www.*-*-*.com/



Thu, 05 Jul 2001 03:00:00 GMT  
 Adding multiple items from File Box to List box
For i = 0 To File1.ListCount - 1
   If File1.Selected(i) then
      If Right(Dir1.Path, 2) = ":\" Then
         x = Dir1.Path & File1.List(i)
      Else
         x = Dir1.Path & "\" & File1.List(i)
      End If
      List1.AddItem x
   End If
Next

Lee Weiner
weiner AT fuse DOT net

Quote:

>I have had one heck of a time figuring out the logic for selecting multiple
>files from a File List box and adding them to a regular list box.
>I can add one at a time, but not multiple files

>I use this code:
>For i = 0 To File1.ListCount - 1
>If Right(Dir1.Path, 2) = ":\" Then
>        x = Dir1.Path & File1.List(i)
>Else
>    x = Dir1.Path & "\" & File1.List(i)
>End If
>List1.AddItem x
>Next

>That adds one at a time just perfectly.
>I've tried:
>Dim I
>    For I = 0 To file1.ListCount - 1
>        If file1.Selected(I) Then
>            list1.additem file1.selected(i)
>        End If
>    Next I
>(among many other iterations) - but just can't figure it out...
>Can someone give me a little help here?



Thu, 05 Jul 2001 03:00:00 GMT  
 Adding multiple items from File Box to List box
Thanks - now I see...it works great.

--
David Wier
http://24.4.49.69
Home of ASP Express - ASP/HTML Text editor for Win95/98/NT
Music To Your Ears
PhoneZ - the Phonebook program for the rest of us.

Quote:

>For i = 0 To File1.ListCount - 1
>   If File1.Selected(i) then
>      If Right(Dir1.Path, 2) = ":\" Then
>         x = Dir1.Path & File1.List(i)
>      Else
>         x = Dir1.Path & "\" & File1.List(i)
>      End If
>      List1.AddItem x
>   End If
>Next

>Lee Weiner
>weiner AT fuse DOT net


>>I have had one heck of a time figuring out the logic for selecting
multiple
>>files from a File List box and adding them to a regular list box.
>>I can add one at a time, but not multiple files

>>I use this code:
>>For i = 0 To File1.ListCount - 1
>>If Right(Dir1.Path, 2) = ":\" Then
>>        x = Dir1.Path & File1.List(i)
>>Else
>>    x = Dir1.Path & "\" & File1.List(i)
>>End If
>>List1.AddItem x
>>Next

>>That adds one at a time just perfectly.
>>I've tried:
>>Dim I
>>    For I = 0 To file1.ListCount - 1
>>        If file1.Selected(I) Then
>>            list1.additem file1.selected(i)
>>        End If
>>    Next I
>>(among many other iterations) - but just can't figure it out...
>>Can someone give me a little help here?



Thu, 05 Jul 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Querying multiple items in a List Box

2. Removing multiple selected items from VB5 List Boxes

3. Can you use multiple items in a list box in a query

4. Select multiple items in list box

5. Removing multiple selected items from VB5 List Boxes

6. list box item consisting of multiple fields

7. Removing multiple selected items from VB5 List Boxes

8. Help wanted with file list boxes and list boxes

9. Problem adding items to a list box

10. adding list box items

11. adding and removing items from a list box

12. Bold text on certain items in a combo box / list box

 

 
Powered by phpBB® Forum Software