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
Printable View
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
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
thnx!
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