Results 1 to 6 of 6

Thread: openfiledialog with no browsing

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2008
    Posts
    1

    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

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width