C#选择文件 OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.InitialDirectory = "C://"; fileDialog.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; fileDialog.FilterIndex = 1; fileDialog.RestoreDirectory = true; if (fileDialog.ShowDialog() == DialogResult.OK) { this.textBox1.Text = fileDialog.FileName; } C#选择文件夹 string path = ""; FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog(); folderBrowserDialog.ShowNewFolderButton = false; if (folderBrowserDialog.ShowDialog() == DialogResult.OK) { path = folderBrowserDialog.SelectedPath; } else { } this.textBox1.Text = path; 得到文件夹下文件目录 string[] dataFiles = Directory.GetFiles(path);
转:http://blog.csdn.net/ytc666/article/details/5313952
关键字词: