Solved

File name validation i.e expression validator

Posted on 2011-02-20
2
811 Views
Last Modified: 2012-05-11
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
Comment
Question by:N_Sri
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 34938584
Like this?
string extension = System.IO.Path.GetExtension(filename).ToLower();

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

Open in new window

0
 

Author Closing Comment

by:N_Sri
ID: 34947173
thankyou
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question