Results 1 to 2 of 2

Thread: Basic File Handling...

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2001
    Posts
    20

    Basic File Handling...

    Okay, so I load a txt file with a location of a file (Ex - c:\test.lts). What I want to do is check if the file c:\test.lts is really there, and if it isn't, I want to let the user know...

    I imagine this is pretty easy to do, but I just don't know...

    Thanks...

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    VB Code:
    1. 'code:
    2. Public Function FileExists(strFileName As String) As Boolean
    3.   Dim intLen As Integer
    4.   If strFileName$ <> "" Then
    5.     intLen% = Len(Dir$(strFileName$))
    6.     FileExists = (Not Err And intLen% > 0)
    7.   Else
    8.     FileExists = False
    9.   End If
    10. End Function
    11.  
    12. 'use:
    13. If FileExists("C:\duh.txt") = False Then Msgbox("Doh!")

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