h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

Validate File Name in VB.Net

bool IsValidFilename(string testName)
{
    Regex containsABadCharacter = new Regex("[" + Regex.Escape(System.IO.Path.InvalidPathChars) + "]");
    if (containsABadCharacter.IsMatch(testName) { return false; };

    // other checks for UNC, drive-path format, etc

    return true;
}

Change .Net Framework in VB.Net


  • Go To Project Property
  • Click "Compile"
  • Click "Advanced Compile Options"
  • Select Framework from the "Target Framework"