Results 1 to 7 of 7

Thread: OpenFileDialog for folders?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    OpenFileDialog for folders?

    I want to use the OpenFileDialog to select a folder, rather than an actual file. The folder name would then be used elsewhere in the app. Is this possible? I set the filter to "", but no luck, that opens the actual folder and shows all files. I can get the folder names and display them in a combo box, but I want this function on the menu. I suppose a menu click could bring up a list box, but can it be done through the OpenFileDialof?
    Thanks.

  2. #2
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    You may want to use the FolderBrowserDialog instead.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    Thanks for the idea, hadn't heard of it before. But everything in Help says
    This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
    So is it ok to use? There's not much in Help on actuallu using it.

  4. #4
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    hmm - have not read that and don't quite understand it, of course, I had a few too martinis last night. This code seems to work fine:
    VB Code:
    1. FolderBrowserDialog1.ShowDialog()
    2.         MessageBox.Show(FolderBrowserDialog1.SelectedPath)

  5. #5
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi.

    The FolderBrowserDialog is only available in VS 2003.

    If you are using 2002 then you have to do some extra work.

    Search MSDN, there's an example somewhere around there.

    Or you can use this class, as is.
    Attached Files Attached Files
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    Thanks to both of you, I'll check that out. I am using 2002. It's not a critical issue, just a nice added feature. Actually, the more I get to know the users, the farther I want to dumb down the program. I don't expect them to know coding, but when they can't answer a question like "What button do you click to print your report?" in an Access form, I just shake my head in frustration, a cousin to apathy.

  7. #7
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    "I don't expect them to know coding, but when they can't answer a question like "What button do you click to print your report?" in an Access form, I just shake my head in frustration, a cousin to apathy."

    That's the price of progress

    In pre Windows days (MS Dos) we had to provide all our own menu options, so applications usually consisted of a series of "Menus" with the text uniquely designed for that application. e.g. in the case you quote

    "Select 1 to Print Report"

    Someone has the signature something like

    "Every time I write an idiot-proof program, someone produces a better idiot"

    There is no argument with that
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

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