Results 1 to 15 of 15

Thread: Re: Classic VB - How can I check if a file exists?

Threaded View

  1. #4
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,654

    Re: Classic VB - How can I check if a file exists?

    IMO, the best and easiest way is to simply use the API function.

    Code:
    Public Declare Function PathFileExists Lib "shlwapi" Alias "PathFileExistsA" (ByVal pszPath As String) As Long
    
    If PathFileExists("C:\whatever.wtv") Then
    It returns 0 if the file/folder doesn't exist. There's also PathFileExistsW if you're dealing with Unicode. I use this function extensively, it works fine in VB. Just pass the full directory info.
    Last edited by fafalone; Jul 6th, 2013 at 06:57 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width