|
-
Mar 15th, 2003, 03:21 AM
#1
Thread Starter
Fanatic Member
Reading files out of an directory
Is there a way to read which files are in a folder, preferrably putting the filenames in a string.
Like:
VB Code:
Dim sFilenames() as String
Object.Folder = "C:\Folder\"
sFilenames() = Object.FilesInFolder
But then in a way that works.
No matter how fool-proof your program is, there will always be a better fool.
Was a post helpful to you? Rate it!
-
Mar 15th, 2003, 03:39 AM
#2
Fanatic Member
Re: Reading files out of an directory
Originally posted by arsmakman
Is there a way to read which files are in a folder, preferrably putting the filenames in a string.
Like:
VB Code:
Dim sFilenames() as String
Object.Folder = "C:\Folder\"
sFilenames() = Object.FilesInFolder
But then in a way that works.
try out FileSystemObject refer MSDN..... for examples
-
Mar 15th, 2003, 08:16 AM
#3
Thread Starter
Fanatic Member
Re: Re: Reading files out of an directory
Originally posted by khalik_ash
try out FileSystemObject refer MSDN..... for examples
I tried MSDN, but got nonethewiser,
please post some code I can use for this.
No matter how fool-proof your program is, there will always be a better fool.
Was a post helpful to you? Rate it!
-
Mar 15th, 2003, 08:40 AM
#4
-
Mar 15th, 2003, 08:45 AM
#5
Or rather than the API, you can use the DIR() function:
VB Code:
Private Sub Form_Load()
Dim strPathToSearch As String
Dim strCurrentPath As String
strPathToSearch = "c:\"
strCurrentPath = Dir(strPathToSearch, vbDirectory)
Do While strCurrentPath <> ""
If strCurrentPath <> "." And strCurrentPath <> ".." Then
Text1.Text = Text1.Text & strCurrentPath & vbCrLf
End If
strCurrentPath = Dir
Loop
End Sub
-
Mar 15th, 2003, 08:46 AM
#6
Thread Starter
Fanatic Member
No matter how fool-proof your program is, there will always be a better fool.
Was a post helpful to you? Rate it!
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
|