To check if a folderpath contains Invalid characters you can use the following snippet.
Sample C#
public static bool IsValidPathName(string pathName)
{
return Path.GetInvalidPathChars().All(invalidChar => pathName.Contains(invalidChar) != true);
}
Sample VB.NET
Public Shared Function IsValidPathName(pathName As String) As Boolean
Return Path.GetInvalidPathChars().All(Function(invalidChar) pathName.Contains(invalidChar) <> True)
End Function
for more informations see the MSDN Path.GetInvalidPathChars Method
RT @CodeSnippetsNET: check if a folderpath contains Invalid chars http://t.co/2QN5gYRK1A #csharp