|
-
Aug 4th, 2002, 03:52 PM
#1
Thread Starter
Fanatic Member
Which variables?
How would I go about importing a drive's contents into a List View control without the use of a file list box? I know how to put them in their respective columns, I just need to know what API files and variables to use.
-
Aug 4th, 2002, 04:48 PM
#2
Frenzied Member
-
Aug 4th, 2002, 05:02 PM
#3
Frenzied Member
I think you can do that with FSO...
-
Aug 4th, 2002, 05:07 PM
#4
Frenzied Member
Yeah.. you can always do it with Scripting Library...aka File System Objects
-
Aug 4th, 2002, 09:36 PM
#5
PowerPoster
Originally posted by moinkhan
Yeah.. you can always do it with Scripting Library...aka File System Objects
Just to be a dickhead, I'm gonna point out that the FSO is just one part of the Scripting library - they're not one and the same thing.
-----------------------------------------
-RJ
[email protected]
-----------------------------------------
-
Aug 4th, 2002, 09:41 PM
#6
The picture isn't missing
to get files from a folder:
VB Code:
Function FilesInPath(strDir As String) As String()
'returns a 0 based array with the directories in strDir
Dim Count As Integer
Dim sFiles() As String
Dim sFile As String
If Right(strDir, 1) <> "\" Then strDir = strDir & "\"
sFile = Dir$(strDir, vbDirectory)
Count = -1
Do
If sFile <> "." And sFile <> ".." Then
If (GetAttr((strDir & sFile)) And vbDirectory) <> vbDirectory Then
Count = Count + 1
ReDim Preserve sFiles(Count)
sFiles(Count) = sFile
End If
End If
sFile = Dir$
Loop Until sFile = ""
FilesInPath = sFiles
End Function
to get folders from a folder:
VB Code:
Function DirsInPath(strDir As String) As String()
'returns a 0 based array with the directories in strDir
Dim Count As Integer
Dim sFiles() As String
Dim sFile As String
If Right(strDir, 1) <> "\" Then strDir = strDir & "\"
sFile = Dir$(strDir, vbDirectory)
Count = -1
Do
If sFile <> "." And sFile <> ".." Then
If (GetAttr((strDir & sFile)) And vbDirectory) Then
Count = Count + 1
ReDim Preserve sFiles(Count)
sFiles(Count) = sFile
End If
End If
sFile = Dir$
Loop Until sFile = ""
DirsInPath = sFiles
End Function
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Aug 4th, 2002, 09:43 PM
#7
The picture isn't missing
oh yeah.. it gives you an array, so for example loop through files in C and adds to listbox:
dim a() as string
dim i as long
a = FilesInPath("C:\")
for i = lbound(a) to ubound(a)
list1.additem a(i)
next i
Remember, if someone's post was not helpful, you can always rate their post negatively  .
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
|