Results 1 to 3 of 3

Thread: Valid File Name

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Post

    Is there a way to check if some string is a valid file name without bunch of if's or select case statements?

    ------------------
    Visual Basic Programmer (at least I want to be one)
    ------------------
    PolComSoft
    You will hear a lot about it.


  2. #2
    Hyperactive Member
    Join Date
    Jul 1999
    Location
    NY, USA
    Posts
    270

    Post

    If you are trying to find out if the file exists, then use this:

    Module Code:
    Code:
    Public Function FileExist(ByVal FileName As String) As Boolean
         If Dir(FileName, vbNormal) <> "" Then
              FileExists = True
         Else
              FileExists = False
         End If
    End Function
    That is untested, but should work.

    ------------------
    Tom Young, 14 Year Old
    [email protected]
    ICQ: 15743470
    AIM: TomY10
    PERL, JavaScript and VB Programmer

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Post

    Thanks for your reply but I'm not trying to find out if file exists. I'm trying to find out if user typed a valid file name (ex. qwerty.txt - valid, *.txt - invalid)

    ------------------
    Visual Basic Programmer (at least I want to be one)
    ------------------
    PolComSoft
    You will hear a lot about it.


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