customizing OpenFileDialog

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rithm
    New Member
    • Nov 2008
    • 2

    customizing OpenFileDialog

    Hi,

    I want to customize FileOpenDialog ,such a way that it will only show folders and should start with some string.


    Thanks
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    I don't think that's possible. Google for BrowseForFolder .

    Comment

    • tlhintoq
      Recognized Expert Specialist
      • Mar 2008
      • 3532

      #3
      You do realize that you haven't asked a question, don't you?
      Posting guidelines for how to ask a question

      You have stated something that you want to do. Ok. Go do it. You don't have to ask permission.

      On the other had I *do* have a question. What good will an Open*FILE*Dialo g do for you if you do manage to modify this sealed class to only show only *FOLDERS*? Personally, I think I would use a FolderBrowserDi alog for purposes where I only wanted to see folders.

      Of course, that's a sealed class too. So you can't modify it or even use it to device a new class that you could modify. So if you are married to the idea of filtering the folders it displays, you'll have to create your own dialog from scratch.

      Comment

      • saeedbadar
        New Member
        • Nov 2008
        • 1

        #4
        I think you cannot resize the FileDialog in .Net directly.

        There is a protected method 'HookProc' in all dialogs. This method provides you access to dialog creation process. But the OpenFileDialog is sealed. So you will not be able to use it directly. You need to use windows API's that support this method. I found this link...


        Another relatively easy solution you can find at:

        Comment

        • vanc
          Recognized Expert New Member
          • Mar 2007
          • 211

          #5
          Originally posted by rithm
          Hi,

          I want to customize FileOpenDialog ,such a way that it will only show folders and should start with some string.


          Thanks
          How can FileOpenDialog just show folder? It's file open dialog, it has to show files to open files. I think you're messing with some confusing ideas here, if you want it to show only some type of file, use Filter, if you want it starts with MyComputer then using SpecialFolder.

          Cheers.

          Comment

          • joedeene
            Contributor
            • Jul 2008
            • 579

            #6
            Why wouldn't the FolderBrowserDi alog help? If you want to show just folders, but I'm not quite clear on the part you said:
            Originally posted by rithm
            ...and should start with some string...
            joedeene

            Comment

            • tlhintoq
              Recognized Expert Specialist
              • Mar 2008
              • 3532

              #7
              Originally posted by rithm
              Hi,

              I want to customize FileOpenDialog ,such a way that it will only show folders and should start with some string.

              Thanks
              The original post was to
              • MODIFY a FileOpenDialog, which can't be done since its a sealed class.
              • Have it show *only* folders. - For what reason we don't know.
              • *Limit* the folders to those starting with a speficied letter.


              Nobody said anything about resizing it, or starting it at a specified directory.

              Rithm: To do what you describe will require you to make your own control from scratch. As suggested a couple times previously, if you just need to browse folders instead of files, there is a component that already does that: The FolderBrowserDi alog

              I don't think there's anything else anyone here can tell you without you supplying a different question or set of needs.

              Regards,
              tlhIn'toQ

              Comment

              Working...