To use FolderBrowserDialog on the company's network to choose a subfolder, follow these steps:
Create a new instance of FolderBrowserDialog class.
Set the RootFolder property of the FolderBrowserDialog instance to the network path of the parent folder where the subfolder is located. For example, if the parent folder is located at "\server\share\parent\", set the RootFolder property to "NetworkPlaces".
Set the ShowNewFolderButton property of the FolderBrowserDialog instance to true if you want to allow the user to create a new subfolder.
Call the ShowDialog method of the FolderBrowserDialog instance to display the dialog box where the user can select the subfolder.
Check the DialogResult property of the FolderBrowserDialog instance to determine if the user clicked the OK button or the Cancel button.
If the user clicked the OK button, get the selected subfolder by accessing the SelectedPath property of the FolderBrowserDialog instance.
Use the selected subfolder in your code as needed.
Here is an example code snippet:
FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.RootFolder = Environment.SpecialFolder.NetworkPlaces;
fbd.SelectedPath = "\\server\share\parent\";
fbd.ShowNewFolderButton = true;
DialogResult result = fbd.ShowDialog();
if (result == DialogResult.OK)
{
string subfolder = Path.Combine(fbd.SelectedPath, "subfolder");
// use the selected subfolder here
}
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-11-02 11:00:00 +0000
Seen: 8 times
Last updated: Jan 01
How can a connection be established on a local network through Docker and Bridge?
How to establish a connection between a VPN and Azure Synapse?
What causes Infinispan 9.4 to fail during the putOperation in TwoPhaseCoordinator.beforeCompletion?
What is causing the Node.js error "EROFS - read-only file system, mkdir"?
How can qemu assign distinct dynamic IP addresses to each of the machines?
How can a blackhole attack be simulated in Network Simulator-2.35?
What is the problem with suspected MTU/MSS and why is it difficult to fix?
How can Azure DevOps Pull Request and Jenkins be utilized within a corporate network?
How can internet traffic be routed through a laptop or another linux device in a network?