CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006
    Posts
    33

    Post Hot to verify existing files

    Greetings.
    I have an application that uses a file TXT as a config file.

    When ever I launch the APP, I need to verify if the file exists, if it doesn't show an OPENFILEDIALOG.

    I need the code to VALIDATE that the file exists.

    Can any1 please help me.

    THANKS
    Mess With The Best & Die Like The Rest

  2. #2
    Join Date
    Aug 2005
    Location
    Imperial College London, England
    Posts
    490

    Re: Hot to verify existing files

    Code:
    If Not System.IO.File.Exists(FileName) Then
      Prompt for file / Create default
    End If
    Help from me is always guaranteed!*
    VB.NET code is made up on the spot with VS2008 Professional with .NET 3.5. Everything else is just made up on the spot.
    Please Remember to rate posts, use code tags, send me money and all the other things listed in the "Before you post" posts.

    *Guarantee may not be honoured.

  3. #3
    Join Date
    Mar 2007
    Location
    Argentina
    Posts
    579

    Re: Hot to verify existing files

    Quote Originally Posted by Crash Override View Post
    ...
    I need the code to VALIDATE that the file exists.
    ...
    Code:
    My.Computer.Filesystem.FileExists(FilePath) returns the boolean answer
    [Vb.NET 2008 (ex Express)]

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

Featured