• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 819
  • Last Modified:

File name validation i.e expression validator

Hi,


I want to write file name file name validation  i .e for Excel file    

FileName.xls  and FileName.xsls  

I am doing for  windows enivorment in C# ..

Can you please  help me  in that...
0
N_Sri
Asked:
N_Sri
1 Solution
 
käµfm³d 👽Commented:
Like this?
string extension = System.IO.Path.GetExtension(filename).ToLower();

if (extension == ".xls" || extension == ".xsls")
{
    // Filename valid.
}

Open in new window

0
 
N_SriAuthor Commented:
thankyou
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now