質問

How do i use folderbrowserdialog ?

I want the user to be able to select any directory he want.

private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBox1.Checked)
            {
                DialogResult result1;
                result1 = new DialogResult();
                folderBrowserDialog1. = "Select New Folder To Collect Files";
                if (result1 == DialogResult.OK)
                {

                }
                else
                {

                }
            }
            else
            {

            }
        }

How can i do it ?

役に立ちましたか?

解決

Something like this?

using (FolderBrowserDialog dialog = new FolderBrowserDialog())
{
    if (dialog.ShowDialog() == DialogResult.OK)
    {
        string path = dialog.SelectedPath;
    }
}

他のヒント

DialogResult result = openFileDialog1.ShowDialog();
  if (result == DialogResult.OK) 
   {
    // Test result.
   }
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top