|
-
Feb 8th, 2002, 09:07 AM
#1
Thread Starter
New Member
you can use this:
public function bFukeExists(sFile as string) as boolean
if len(dir$(sFile)) = 0 then
bFileExists = false
else
bFileExists = true
end if
end function
-
Feb 8th, 2002, 10:14 AM
#2
Ok, here you go:
Code:
Private Sub Command1_Click()
If FileExists("c:\games\visualbasic.txt") Then
MsgBox "Yes, it is there!"
Else
MsgBox "Too bad, it is not there!"
End If
End Sub
Private Function FileExists(ByVal strPath As String) As Boolean
Dim bFileExists As Boolean
bFileExists = False
On Error Resume Next
bFileExists = Len(Dir(strPath)) > 0
On Error GoTo 0
FileExists = bFileExists
End Function
-
Feb 9th, 2002, 06:06 AM
#3
Lively Member
-
Feb 9th, 2002, 10:55 AM
#4
Fanatic Member
Oh, DIR is great
but wouldn't u try another way?
VB Code:
Open SRC$ for binary as #1
If LOF(#1)=0 Then Close #1: Kill SRC$: Exit Sub
Close #1
ASM,C,C++,BASIC,VB,JAVA,VBS,HTML,ASP,PHP,mySQL,VB.NET,MATLAB
Programming is fun, but only if you're not on a tight deadline 
So I consider all those working engineers sad people
VB FTP class
3 page PHP crash course
Crash Course on DX9 Managed with VB.NET covering basics till terrain creation
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
|