How to browse for folder

前端 未结 4 1386
灰色年华
灰色年华 2020-12-18 04:30

I want to design a program contain browse button, where we can browse to the selected folder and open the file inside the folder.

I need a reference and reading wher

4条回答
  •  旧巷少年郎
    2020-12-18 04:57

    From toolbox drag a FolderBrowserDialog component to your form and name it folderBrowserDialog. In your browse button event handler write following code.

        private void btnBrowseBackupLocation_Click(object sender, EventArgs e)
        {
            DialogResult result = folderBrowserDialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                txtboxBackupLocation.Text = folderBrowserDialog.SelectedPath;
            }
        }
    

提交回复
热议问题