G genc ymeri Feb 24, 2004 #1 Hi, How can I get the extention name of one file when I have a file list ? Thanks.
B Bob Boran Feb 24, 2004 #2 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("."));
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("."));
G genc ymeri Feb 24, 2004 #3 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(".")); Click to expand...
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(".")); Click to expand...