c#winform选择文件,文件夹,打开指定目录方法
2014-06-03 16:47
796 查看
private
void btnFile_Click(object sender, EventArgs e)
{
OpenFileDialog fileDialog=
new OpenFileDialog();
fileDialog.Multiselect=
true;
fileDialog.Title=
"请选择文件";
fileDialog.Filter="所有文件(*.*)|*.*";
if (fileDialog.ShowDialog() == DialogResult.OK)
{
string file=fileDialog.FileName;
MessageBox.Show("已选择文件:" + file,"选择文件提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
privatevoid btnPath_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog=
new FolderBrowserDialog();
dialog.Description=
"请选择文件路径";
if (dialog.ShowDialog() == DialogResult.OK)
{
string foldPath = dialog.SelectedPath;
MessageBox.Show("已选择文件夹:" + foldPath,
"选择文件夹提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
privatevoid btnOpen_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("Explorer.exe","c:\\windows");
}
void btnFile_Click(object sender, EventArgs e)
{
OpenFileDialog fileDialog=
new OpenFileDialog();
fileDialog.Multiselect=
true;
fileDialog.Title=
"请选择文件";
fileDialog.Filter="所有文件(*.*)|*.*";
if (fileDialog.ShowDialog() == DialogResult.OK)
{
string file=fileDialog.FileName;
MessageBox.Show("已选择文件:" + file,"选择文件提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
privatevoid btnPath_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog=
new FolderBrowserDialog();
dialog.Description=
"请选择文件路径";
if (dialog.ShowDialog() == DialogResult.OK)
{
string foldPath = dialog.SelectedPath;
MessageBox.Show("已选择文件夹:" + foldPath,
"选择文件夹提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
privatevoid btnOpen_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("Explorer.exe","c:\\windows");
}
相关文章推荐
- c#winform选择文件,文件夹,打开指定目录方法
- c#winform选择文件,文件夹,打开指定目录方法
- c#winform选择文件,文件夹,打开指定目录方法
- c#winform选择文件,文件夹,打开指定目录方法
- C# winform选择文件,文件夹,打开指定目录方法
- c#winform选择文件,文件夹,打开指定目录方法
- c#winform选择文件,文件夹,打开指定目录方法
- c#winform选择文件/文件夹/打开指定目录方法
- c#winform选择文件,文件夹,打开指定目录方法
- c#winform选择文件,文件夹,打开指定目录方法
- C# winform打开文件夹并选中指定文件
- C# 遍历指定目录下的所有文件及文件夹以及遍历数据库的方法
- C# WINFORM 编程中,选择**文件夹**而不是文件的方法
- C# 002 浏览(或叫:选择)、打开 文件和文件夹(或叫:目录)
- 打开文件夹,定位指定文件[c# WinForm]
- c#winform打开指定目录的方法
- C#获取FTP目录下文件夹、文件的方法,进而判断FTP下指定文件夹是否存在
- C#打开文件夹并定位到指定的文件
- 打开一个树型目录选择文件夹(不选择文件)
- C#直接打开指定的文件和文件夹