|
-
Sep 30th, 2000, 09:45 AM
#1
Thread Starter
Member
Hi
I have a ListBox with possible new filenames, say 10 items
and if I at the same time have a FileList with 10 files,
can I rename all the 10 files with the names I have in the List box in one single action.
The filenames has to be called 01-10.filename, so the app knows what it is looking for.
I have tried with For loops but I havent gotten any near it.
Hope you can help
Thanks
Best regrads,
Chris Davidsen
Christian Davidsen
If you go to sleep with an itchy
ass, you wake up with smelly fingers.
-
Sep 30th, 2000, 09:57 AM
#2
Addicted Member
Yes. it is possible.
you can use always use For loops when dealing with collections.
For example :
For i = 0 To ListBox.ListCount
rename FileList.list(i).FileName ListBox.List(i)
Next i
I hope that solve your problem.
 Stupidity is better than cure.
VB6 SP5 Enterprise Ed.
C, Pascal, VC++ 6.0
Running Win98 SE and Win2000 Prof. Ed.
Email me at : [email protected]
-
Sep 30th, 2000, 11:03 AM
#3
Thread Starter
Member
wrong number or argument
Hi rbnwares
I tried your code
amd my code looks like this
--------------------------------------
Dim Oldname
Dim Newname
For i = 0 To List1.ListCount
Label1 = i
Oldname = Dir1.Path & "\" & File1.List(i).filename
Newname = Dir1.Path & "\" & List1.List(i)
Name Oldname As Newname
Next i
---------------------------------------
but it does not like File1.List(i), wrong argument
do you have any other clues
Thanks
Chris Davidsen
Christian Davidsen
If you go to sleep with an itchy
ass, you wake up with smelly fingers.
-
Sep 30th, 2000, 11:12 AM
#4
Hyperactive Member
Listindex
try list1.listindex=i instead of list1.index(i)
WP
-
Oct 9th, 2000, 02:59 AM
#5
i think your error might be in the fact that i becomes too big. use the list count but subtract one as in below.
For i = 0 To ListBox.ListCount - 1
rename FileList.list(i).FileName ListBox.List(i)
Next i
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|