version of .net + folder browser

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • juli jul

    version of .net + folder browser


    Hello ,I am working with
    ..Net Framework 1.1 - Version:1.1.432 2
    and Development Enviroment2003 - Version 7.1.3088.

    Is this version of .Net supposed to have a normal folder browser or
    might be that the version is the reason I don't have a normal folder
    browser?
    If not,which control could I use instead?
    Thank you very much!


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • Cor Ligthert

    #2
    Re: version of .net + folder browser

    Juli Jul,

    Did you try this one
    {
    FolderBrowserDi alog fb = new FolderBrowserDi alog();
    fb.ShowDialog() ;
    MessageBox.Show (fb.SelectedPat h);
    }

    I thought that I told you in a previous version that the standart Net 1.1
    version has a bug which is repared in Net SP1. However this it has to do
    withouth that as well when your paths are shorter than 128 characters.

    I hope this helps?

    Cor


    Comment

    • DalePres

      #3
      Re: version of .net + folder browser

      Define "normal folder browser". The options are the
      System.Windows. Forms.FolderBro wserDialog or to use the SHBrowseForFold er
      function in the Shell32.dll.

      HTH

      DalePres

      "juli jul" <juli8024@yahoo .com> wrote in message
      news:%23HYFKaOG FHA.3824@TK2MSF TNGP10.phx.gbl. ..[color=blue]
      >
      > Hello ,I am working with
      > Net Framework 1.1 - Version:1.1.432 2
      > and Development Enviroment2003 - Version 7.1.3088.
      >
      > Is this version of .Net supposed to have a normal folder browser or
      > might be that the version is the reason I don't have a normal folder
      > browser?
      > If not,which control could I use instead?
      > Thank you very much!
      >
      >
      > *** Sent via Developersdex http://www.developersdex.com ***
      > Don't just participate in USENET...get rewarded for it![/color]


      Comment

      • juli jul

        #4
        Re: version of .net + folder browser

        Hello,
        with the normal folder I mean the :
        System.Windows. Forms.FolderBro wserDialog folderBrowserDi alog1;
        I tried to do the ShowDialog() method and all I can see is still an
        empty window with no folders to choose.
        Could someone help? Thank you!



        *** Sent via Developersdex http://www.developersdex.com ***
        Don't just participate in USENET...get rewarded for it!

        Comment

        • Cor Ligthert

          #5
          Re: version of .net + folder browser

          Juli,

          Did you try my code snippet?

          Direct in line, by instance in a load of the form.

          Cor


          Comment

          • juli jul

            #6
            Re: version of .net + folder browser


            Hello,
            Yes I tried this code and still see an empty window ,the message box
            which suppose to show the path to the folder is empty (no selected
            path).
            Is there some solution for it?
            Thank you!


            *** Sent via Developersdex http://www.developersdex.com ***
            Don't just participate in USENET...get rewarded for it!

            Comment

            • Ping Yang

              #7
              Re: version of .net + folder browser

              try STAThread. The FolderBrowserDi alog does not support MTA
              "juli jul" <juli8024@yahoo .com> wrote in message
              news:OBMJs%23OG FHA.1264@TK2MSF TNGP12.phx.gbl. ..[color=blue]
              > Hello,
              > with the normal folder I mean the :
              > System.Windows. Forms.FolderBro wserDialog folderBrowserDi alog1;
              > I tried to do the ShowDialog() method and all I can see is still an
              > empty window with no folders to choose.
              > Could someone help? Thank you!
              >
              >
              >
              > *** Sent via Developersdex http://www.developersdex.com ***
              > Don't just participate in USENET...get rewarded for it![/color]


              Comment

              • juli jul

                #8
                Re: version of .net + folder browser


                Hello,
                Could you please explain how to use the STAThread and how do I implement
                the folder browser with it?
                Thank you!


                *** Sent via Developersdex http://www.developersdex.com ***
                Don't just participate in USENET...get rewarded for it!

                Comment

                • Ping Yang

                  #9
                  Re: version of .net + folder browser

                  Hi,

                  If my guess is correct. Change the attribute [MTAThread] to [STAThread] In
                  the Main function.

                  If you have to use MTAThread, the only way to show the folder browser is use
                  the SHBrowseForFold er function in the Shell32.dll.
                  Though this function doesn't support 'Make a new folder' button when you use
                  MTAThread.

                  The website http://www.netomatix.com/FolderBrowser.aspx might help you to
                  wrap the FolderBrower class.

                  Ping


                  "juli jul" <juli8024@yahoo .com> wrote in message
                  news:ujBGT4XGFH A.3728@TK2MSFTN GP14.phx.gbl...[color=blue]
                  >
                  > Hello,
                  > Could you please explain how to use the STAThread and how do I implement
                  > the folder browser with it?
                  > Thank you!
                  >
                  >
                  > *** Sent via Developersdex http://www.developersdex.com ***
                  > Don't just participate in USENET...get rewarded for it![/color]


                  Comment

                  • juli jul

                    #10
                    Re: version of .net + folder browser


                    Hello,
                    I tried to make a new project with only the folder browser in it and it
                    works there but inside mine project it doesn't.Is it possible that this
                    control can't be at the same form with some other control?
                    Are there some kind of sources with which I could implement the folder
                    browser some other way?
                    Thanks a lot!

                    *** Sent via Developersdex http://www.developersdex.com ***
                    Don't just participate in USENET...get rewarded for it!

                    Comment

                    • Ping Yang

                      #11
                      Re: version of .net + folder browser

                      Hi, Juli

                      To implement your own folder browser, That is a lot of work. personally I
                      don't think that is a good way to do.

                      What type is project? Windows Application? Please dobule check what
                      attributes applied to Main function.

                      Another way to identify if it is MTAThread problem. On your new test
                      project, change the STAThread to MTAThread; if you get the same result as
                      your project does, just change the attribute should fix your problem.

                      Help this helps


                      "juli jul" <juli8024@yahoo .com> wrote in message
                      news:u9vhBCdGFH A.588@TK2MSFTNG P14.phx.gbl...[color=blue]
                      >
                      > Hello,
                      > I tried to make a new project with only the folder browser in it and it
                      > works there but inside mine project it doesn't.Is it possible that this
                      > control can't be at the same form with some other control?
                      > Are there some kind of sources with which I could implement the folder
                      > browser some other way?
                      > Thanks a lot!
                      >
                      > *** Sent via Developersdex http://www.developersdex.com ***
                      > Don't just participate in USENET...get rewarded for it![/color]


                      Comment

                      • juli jul

                        #12
                        Re: version of .net + folder browser

                        Hello,
                        Could you please tell me how to check those attributes in main,I tried
                        to read about it in the net bit somehow not sure how to do it?
                        Thank you very much!



                        *** Sent via Developersdex http://www.developersdex.com ***
                        Don't just participate in USENET...get rewarded for it!

                        Comment

                        • Ping Yang

                          #13
                          Re: version of .net + folder browser

                          Hi, Juli

                          I can give you 2 ways to check the COM threading model.

                          1. find your Main function, you might find there are attributes applied to
                          the Main function, usually it looks like
                          [STAThread]
                          static void Main()
                          {
                          ...
                          }


                          2. If you are not able to get your Main function source (I presume the
                          source file is owned by somebody else), you still can get the current COM
                          threading model by calling ApartmentState in Thread class, it looks like

                          using System.Threadin g; // you have to add this namespace

                          ApartmentState state = Thread.CurrentT hread.Apartment State;
                          // you can set breakpoint here to check the value of state. or pop up a
                          message box to display it.


                          Add this code just before your call ShowDialog function, you will know what
                          COM threading model the FolderBrowser is running on?

                          Help this helps


                          "juli jul" <juli8024@yahoo .com> wrote in message
                          news:%236uEm$zG FHA.2156@TK2MSF TNGP09.phx.gbl. ..[color=blue]
                          > Hello,
                          > Could you please tell me how to check those attributes in main,I tried
                          > to read about it in the net bit somehow not sure how to do it?
                          > Thank you very much!
                          >
                          >
                          >
                          > *** Sent via Developersdex http://www.developersdex.com ***
                          > Don't just participate in USENET...get rewarded for it![/color]


                          Comment

                          • juli jul

                            #14
                            Re: version of .net + folder browser


                            The messagebox result was that I have a MTA attribute-what does that
                            mean and should I change it (and how) in order to see folders in
                            browser?
                            Thanks a lot!


                            *** Sent via Developersdex http://www.developersdex.com ***
                            Don't just participate in USENET...get rewarded for it!

                            Comment

                            • Ping Yang

                              #15
                              Re: version of .net + folder browser

                              You have to change the attribute in Main function, it should look like
                              [STAThread]
                              static void Main()
                              {
                              .....
                              }


                              find your Main function, you will notice that there is [MTAThread] attribute
                              just before Main function; Change it to STAThread, the FolderBrowser should
                              work. It is just like what I said at very beginning.

                              Help this helps


                              "juli jul" <juli8024@yahoo .com> wrote in message
                              news:%23wpD2b1G FHA.3612@TK2MSF TNGP09.phx.gbl. ..[color=blue]
                              >
                              > The messagebox result was that I have a MTA attribute-what does that
                              > mean and should I change it (and how) in order to see folders in
                              > browser?
                              > Thanks a lot!
                              >
                              >
                              > *** Sent via Developersdex http://www.developersdex.com ***
                              > Don't just participate in USENET...get rewarded for it![/color]


                              Comment

                              Working...