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.
Printable View
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.
If you are trying to find out if the file exists, then use this:
Module Code:
That is untested, but should work.Code:Public Function FileExist(ByVal FileName As String) As Boolean
If Dir(FileName, vbNormal) <> "" Then
FileExists = True
Else
FileExists = False
End If
End Function
------------------
Tom Young, 14 Year Old
[email protected]
ICQ: 15743470
AIM: TomY10
PERL, JavaScript and VB Programmer
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.