OpenFileDialog.OpenFile 方法
http://msdn.microsoft.com/zh-cn/library/system.windows.forms.openfiledialog.openfile%28VS.80%29.aspx
  
*****************************************************************************
签名档: http://feiyun0112.cnblogs.com/

解决方案 »

  1.   

    MSDN OpenFileDialog http://msdn.microsoft.com/zh-cn/library/system.windows.forms.openfiledialog.aspx
    Sample:
    private void button1_Click(object sender, System.EventArgs e)
    {
        Stream myStream = null;
        OpenFileDialog openFileDialog1 = new OpenFileDialog();    openFileDialog1.InitialDirectory = "c:\\" ;
        openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
        openFileDialog1.FilterIndex = 2 ;
        openFileDialog1.RestoreDirectory = true ;    if(openFileDialog1.ShowDialog() == DialogResult.OK)
        {
            try
            {
                if ((myStream = openFileDialog1.OpenFile()) != null)
                {
                    using (myStream)
                    {
                        // Insert code to read the stream here.
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
            }
        }
    }
      

  2.   

    拖一个folderBrowserDialog1控件,然后就可以通过this.folderBrowserDialog1.SelectedPath获得路径。
    如: private void button1_Click(object sender, EventArgs e)
            {
                if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK)
                {
                    string path = this.folderBrowserDialog1.SelectedPath;
                    MessageBox.Show(path + "");
                }
            }
      

  3.   

    OpenFileDialog.OpenFile 用这个
      

  4.   

    DialogResult dr = openFileDialog1.ShowDialog();            if (dr == DialogResult.OK)
                {
                    if (openFileDialog1.FileName != "openFileDialog1")
                        textBox1.Text = openFileDialog1.FileName;
                }