openfiledialog with no browsing
I would like to have something like the openfiledialog, but disable the browsing of folders other than sub folders of the InitialDirectory. So no "Look in:"
and it would be nice to disable the places bar to the left without having to modify the registry before showing the dialog.
Can this be done with vb 2005?
in my case I only want files to be listed that are on the cdrom...
Code:
Dim allDrives() As IO.DriveInfo = IO.DriveInfo.GetDrives()
Dim d As IO.DriveInfo
For Each d In allDrives
If d.IsReady = True And d.DriveType = IO.DriveType.CDRom Then
OpenFileDialog1.InitialDirectory = d.Name
OpenFileDialog1.DefaultExt = "exe"
OpenFileDialog1.Filter = "exe files (*.exe)|*.exe"
OpenFileDialog1.ShowDialog()
End If
Next
Thanks for any help you can provide.
chris
Re: openfiledialog with no browsing
AFAIK, no. You can specify certain areas to filter like network domains etc but to prevent specific directories you will need to either write your own dialog or set permissions on the folders throughout your system. Obviously creating your own will be much easier.
Re: openfiledialog with no browsing
Follow the Customising Common Dialogs link in my signature. It will give you the basics but you'd have to work out the specific messages and responses you need to handle for yourself.
Re: openfiledialog with no browsing
But with the amount of work/code that will take its really not worth it and wont get you everything you desire. IMO, it would be better for you to build your own exactly as you need it.
Re: openfiledialog with no browsing
Quote:
Originally Posted by RobDog888
But with the amount of work/code that will take its really not worth it and wont get you everything you desire. IMO, it would be better for you to build your own exactly as you need it.
The advantage of using the existing class is that you get the consistent look and feel. I agree that it might be a fair bit of work though so, if maintaining complete consistency with the standard Windows UI is not critical, a custom dialogue would be easier. probably just a TreeView and a ListView would be the way to go.
Re: openfiledialog with no browsing
But with the amount of customizations and removals it will not follow any standards of Windows dialog so thats why I suggest building your own in this case.