c#获取文件路径

首先的引入 using System.IO; 

OpenFileDialog file = new OpenFileDialog();
file.ShowDialog();  
string selectfile = file.SafeFileName; 
FileInfo finfo = new FileInfo(selectfile);
this.textBox1.Text = finfo.Directory.ToString() + @"\" + finfo.Name;

posted @ 2017-09-05 20:07  无止境!  阅读(1145)  评论(0编辑  收藏  举报