打开文件路径:
OpenFileDialog fd = new OpenFileDialog();
fd.Multiselect = false;
fd.Title = "Please Select File";
fd.Filter = "dll文件|*.dll";
if (fd.ShowDialog() == DialogResult.OK)
{
tbPath.Text = fd.FileName;
}
保存文件路径:
SaveFileDialog fd = new SaveFileDialog();
fd.Title = "保存文件";
fd.Filter = "xml文件|*.xml";
if (fd.ShowDialog() == DialogResult.OK)
{
tbPath.Text = fd.FileName;
}
选择文件夹路径:
FolderBrowserDialog fbd = new FolderBrowserDialog();
bd.Description = "请选择文件夹:";
if (fbd.ShowDialog() == DialogResult.OK)
{
tbPath.Text = fbd.SelectedPath;
}
网友评论