I want to open a "OpenFileDialog", on which we can select only local hard drives (ex. C:\,D:). I want to add restrictions to access network drives. I have used following code but I am able to access the network drive.
Code is given below:
OpenFileDialog dialog = new OpenFileDialog();
dialog.CustomPlaces.Clear();
foreach (DriveInfo Drive in DriveInfo.GetDrives())
{
if (Drive.DriveType == DriveType.Fixed)
{
dialog.CustomPlaces.Add(Drive.Name);
}
}
dialog.ShowDialog();