|
-
Sep 11th, 2001, 12:37 AM
#1
Thread Starter
Lively Member
finding whether a folder exists or not
hello
i want to find whether a folder exists or not
how can i do
please help me
-
Sep 11th, 2001, 01:12 AM
#2
Lively Member
try this :
VB Code:
Option Explicit
Private Sub Form_Load()
Dim myFolder As String
myFolder = Dir$("C:\SampleFolder\")
If myFolder = "" Then
MsgBox "Folder does not exist!"
ElseIf myFolder <> "" Then
MsgBox "Folder Exist!"
End If
End Sub
You never become a failure, unless you quit on trying!!!
-
Sep 11th, 2001, 02:05 AM
#3
Thread Starter
Lively Member
problem with code
the above code is working but
it is working if the folder contains any file
otherwise the
function is returning empty string
the i am not able to verify
can u help me
-
Sep 11th, 2001, 02:25 AM
#4
Fanatic Member
VB Code:
If Dir$("c:\somedir", vbDirectory) <> "" Then
'directory exists
Else
'directory doesn't exist
End If
That should work even if the dir has no files in it, since you're explicitly looking for the dir.
I'm baaaack...
VB5 Professional Edition, VC++ 6
Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se
I feel special because I finally figured out how to loop midis: Post link
I'm a fanatic too 
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
|