Results 1 to 3 of 3

Thread: Invalid File Name characters

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    195

    Invalid File Name characters

    Apart from these characters :

    \ / : * ? " < > |

    Are all other ASCII characters up to #255 valid for file names?
    Using Visual Studio .NET 2005

  2. #2

  3. #3
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    This may be of interest:

    VB Code:
    1. Public Function SafeFileName(ByVal oldFile As String) As String
    2. Dim ServDir As String
    3. Dim BadChars As String, BadChar As String, x As Long
    4. BadChars = "\/:*?""<>|"
    5. ServDir = oldFile
    6.  
    7. For x = 1 To Len(BadChars)
    8.     BadChar = Mid$(BadChars, x, 1)
    9.     ServDir = Replace(ServDir, BadChar, "_")
    10. Next
    11. SafeFileName = ServDir
    12. End Function

    Some code I wrote.

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