Results 1 to 4 of 4

Thread: 1. Copy and paste 2. Check if file = there

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    Israel
    Posts
    15
    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

  2. #2
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926
    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

  3. #3
    Lively Member tonnic's Avatar
    Join Date
    Dec 2001
    Location
    Netherlands
    Posts
    107
    thnx!

  4. #4
    Fanatic Member jian2587's Avatar
    Join Date
    Aug 2000
    Location
    I bet u need a fusion powered shuttle to reach my place...
    Posts
    963
    Oh, DIR is great
    but wouldn't u try another way?
    VB Code:
    1. Open SRC$ for binary as #1
    2. If LOF(#1)=0 Then Close #1: Kill SRC$: Exit Sub
    3. 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
  •  



Click Here to Expand Forum to Full Width