Opening a directory chooser in C#Prevent user from changing file name in “SaveFileDialog”How do I calculate someone's age in C#?What is the difference between String and string in C#?Hidden Features of C#?Calling the base constructor in C#Cast int to enum in C#How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?What are the correct version numbers for C#?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?Why not inherit from List<T>?

What's that red-plus icon near a text?

Why do I get two different answers for this counting problem?

Why are electrically insulating heatsinks so rare? Is it just cost?

How much RAM could one put in a typical 80386 setup?

How does quantile regression compare to logistic regression with the variable split at the quantile?

RSA: Danger of using p to create q

Can I ask the recruiters in my resume to put the reason why I am rejected?

Client team has low performances and low technical skills: we always fix their work and now they stop collaborate with us. How to solve?

Arrow those variables!

A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?

Is it possible to do 50 km distance without any previous training?

Why is 150k or 200k jobs considered good when there's 300k+ births a month?

Add text to same line using sed

Do I have a twin with permutated remainders?

Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?

Languages that we cannot (dis)prove to be Context-Free

Approximately how much travel time was saved by the opening of the Suez Canal in 1869?

How much of data wrangling is a data scientist's job?

Is it legal for company to use my work email to pretend I still work there?

How to draw a waving flag in TikZ

Could an aircraft fly or hover using only jets of compressed air?

Are the number of citations and number of published articles the most important criteria for a tenure promotion?

Is it possible to run Internet Explorer on OS X El Capitan?

Character reincarnated...as a snail



Opening a directory chooser in C#


Prevent user from changing file name in “SaveFileDialog”How do I calculate someone's age in C#?What is the difference between String and string in C#?Hidden Features of C#?Calling the base constructor in C#Cast int to enum in C#How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?What are the correct version numbers for C#?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?Why not inherit from List<T>?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








20















I am writing a quick and dirty application that reads all the files from a given directory. I'm currently using the OpenFileDialog to choose a directory and just culling off the file name that it provides. It seems like there should be a way to just choose directories though, but in a quick browsing of MSDN I didn't find it.



If you have a way in winforms or more preferably in WPF I'm all ears.










share|improve this question




























    20















    I am writing a quick and dirty application that reads all the files from a given directory. I'm currently using the OpenFileDialog to choose a directory and just culling off the file name that it provides. It seems like there should be a way to just choose directories though, but in a quick browsing of MSDN I didn't find it.



    If you have a way in winforms or more preferably in WPF I'm all ears.










    share|improve this question
























      20












      20








      20


      1






      I am writing a quick and dirty application that reads all the files from a given directory. I'm currently using the OpenFileDialog to choose a directory and just culling off the file name that it provides. It seems like there should be a way to just choose directories though, but in a quick browsing of MSDN I didn't find it.



      If you have a way in winforms or more preferably in WPF I'm all ears.










      share|improve this question














      I am writing a quick and dirty application that reads all the files from a given directory. I'm currently using the OpenFileDialog to choose a directory and just culling off the file name that it provides. It seems like there should be a way to just choose directories though, but in a quick browsing of MSDN I didn't find it.



      If you have a way in winforms or more preferably in WPF I'm all ears.







      c# wpf winforms






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 12 '08 at 17:56









      Dan BlairDan Blair

      1,86131731




      1,86131731






















          2 Answers
          2






          active

          oldest

          votes


















          38














          You'll want to use a FolderBrowserDialog.






          share|improve this answer






























            14














            using FORMS = System.Windows.Forms;

            var dialog = new System.Windows.Forms.FolderBrowserDialog();
            FORMS.DialogResult result = dialog.ShowDialog();
            if (result == FORMS.DialogResult.OK)

            MessageBox.Show("Result: " + dialog.SelectedPath);






            share|improve this answer

























              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f284751%2fopening-a-directory-chooser-in-c-sharp%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              38














              You'll want to use a FolderBrowserDialog.






              share|improve this answer



























                38














                You'll want to use a FolderBrowserDialog.






                share|improve this answer

























                  38












                  38








                  38







                  You'll want to use a FolderBrowserDialog.






                  share|improve this answer













                  You'll want to use a FolderBrowserDialog.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 12 '08 at 17:58









                  KibbeeKibbee

                  51.8k26133172




                  51.8k26133172























                      14














                      using FORMS = System.Windows.Forms;

                      var dialog = new System.Windows.Forms.FolderBrowserDialog();
                      FORMS.DialogResult result = dialog.ShowDialog();
                      if (result == FORMS.DialogResult.OK)

                      MessageBox.Show("Result: " + dialog.SelectedPath);






                      share|improve this answer





























                        14














                        using FORMS = System.Windows.Forms;

                        var dialog = new System.Windows.Forms.FolderBrowserDialog();
                        FORMS.DialogResult result = dialog.ShowDialog();
                        if (result == FORMS.DialogResult.OK)

                        MessageBox.Show("Result: " + dialog.SelectedPath);






                        share|improve this answer



























                          14












                          14








                          14







                          using FORMS = System.Windows.Forms;

                          var dialog = new System.Windows.Forms.FolderBrowserDialog();
                          FORMS.DialogResult result = dialog.ShowDialog();
                          if (result == FORMS.DialogResult.OK)

                          MessageBox.Show("Result: " + dialog.SelectedPath);






                          share|improve this answer















                          using FORMS = System.Windows.Forms;

                          var dialog = new System.Windows.Forms.FolderBrowserDialog();
                          FORMS.DialogResult result = dialog.ShowDialog();
                          if (result == FORMS.DialogResult.OK)

                          MessageBox.Show("Result: " + dialog.SelectedPath);







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Jun 8 '15 at 1:18









                          FrostyFire

                          2,61122046




                          2,61122046










                          answered Apr 3 '13 at 14:31









                          GeoffGeoff

                          14912




                          14912



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f284751%2fopening-a-directory-chooser-in-c-sharp%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

                              Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

                              Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved