如何实现文件路径的选择,并将选择的文件路径填写到textbox文本框中?

解决方案 »

  1.   

    WINFORM
    方法一: 
    string filename = openFileDialog1.FileName.ToString(); 
    int start = filename.LastIndexOf('\\'); 
    this.textBox2.Text = filename.Substring(start + 1,filename.Length - start - 1);
    方法2: 
    string str = openFileDialog1.FileName.ToString(); 
    int nleng = str.Length - str.LastIndexOf("\\") - 1; 
    this.textBox2.Text =nleng; 
    webform
    由于IE的安全机制问题 IE6可以。以上的不行。
    http://dotnet.chinaitlab.com/ASPNET/836434.html
      

  2.   

    OpenFileDialog
    楼主看看api应该就懂了 百度或者google之