c#选择文件文件夹

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);
上一篇:QTP下载链接


下一篇:spring学习 十二 AspectJ-based的通知入门 带参数的通知