AndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2006 Andrea Tincani
:: Function to find if file exists

Author  

David Costelloe

Language  

VB5, VB6

Operating Systems  

Windows 95, 98 and NT
Module

Public Function FileExists(filename As String) As Boolean
    FileExists = (Dir(filename, vbNormal Or vbReadOnly Or vbHidden Or vbSystem Or vbArchive) <> "")
End Function

Usage

'Usage:
Private Sub Command1_Click()
    If FileExists("C:\Config.sys") Then
        MsgBox "Config.sys is available"
    Else
        MsgBox "Sorry Can't find Config.sys"
    End If
End Sub

:: Navigation

Home

Files and Disks Tips

Previous Tip

Next Tip

:: Search this site
Google
Web andreavb.com
:: Related Topics
icon 11-04-2006 VB SQL - Fieldname,etc - simple PROBLEM by zarkorgon
icon 11-04-2006 VB SQL - Fieldname,etc - simple PROBLEM by zarkorgon
icon 16-03-2006 Re: Accurate Progressbar by Goran
icon 25-02-2006 EOF error by niyati
icon 08-02-2006 DLL Help by ~Bean~

AndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2006 Andrea Tincani