getting Extentionfile ...

  • Thread starter Thread starter genc ymeri
  • Start date Start date
G

genc ymeri

Hi,
How can I get the extention name of one file when I have a file list ?

Thanks.
 
here are 2 different options

-----------------------
string FilePath = "c:\\hello.exe";
// option 1
System.IO.FileInfo fi = new System.IO.FileInfo(FilePath);
this.textBox1.Text = fi.Extension ;
// option 2
this.textBox2.Text = FilePath.Substring(FilePath.LastIndexOf("."));
 
Thanks a lot.....



Bob Boran said:
here are 2 different options

-----------------------
string FilePath = "c:\\hello.exe";
// option 1
System.IO.FileInfo fi = new System.IO.FileInfo(FilePath);
this.textBox1.Text = fi.Extension ;
// option 2
this.textBox2.Text = FilePath.Substring(FilePath.LastIndexOf("."));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top