PDA

Click to See Complete Forum and Search --> : Valid File Name


QWERTY
Nov 8th, 1999, 02:41 AM
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.

Compwiz
Nov 8th, 1999, 02:53 AM
If you are trying to find out if the file exists, then use this:

Module 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
tyoung@stny.rr.com
ICQ: 15743470
AIM: TomY10
PERL, JavaScript and VB Programmer

QWERTY
Nov 8th, 1999, 03:02 AM
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.