选择文件夹

        private void btnSelete_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();
            dialog.Description = "请选择文件路径";
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                lblSelete.Text = dialog.SelectedPath;
            }
        }

打开文件夹

            //打开文件夹
            System.Diagnostics.Process.Start("explorer.exe", lblSelete.Text+@"\");

选择文件

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);
}

 

相关文章:

  • 2021-08-22
  • 2022-02-01
  • 2021-09-15
猜你喜欢
  • 2022-12-23
  • 2021-05-24
  • 2021-11-30
  • 2022-01-20
  • 2021-12-05
相关资源
相似解决方案