6

So I have a folder browser dialog and am having issues with the selected path.

So I want the previous folder that was opened to be selected, and I want it to be scrolled down so that the previous folder is visible.

Now the strange thing is that this works fine, but only sometimes. It's completely random. The path is always highlighted, but it doesn't always scroll down.

Sometimes when I start debugging and click browse, it will open up and be scrolled down to where I want. Then I click ok, click browse again and it's completely random whether or not it's scrolled down to where it should be.

Any thoughts?

Edit: I searched around a lot and found this. It seems to be quite similar to my problem.

"I have tried the test app on Vista 32, XP 32, Win 7 32 & 64. It works fine on everything except Windows 7. Both 32 and 64 appear to have the same issue."

They're saying it's a glitch with Windows 7...?

NMunro
  • 1,282
  • 4
  • 18
  • 33
  • I don't know, but I posted a [similar question](http://stackoverflow.com/questions/8404394/is-it-possible-to-make-a-folderbrowserdialogs-default-path-show-up-in-a-library) and was having the same scrolling issue as you. Never got the scrolling issue resolved. – Scott Chamberlain Sep 14 '12 at 17:54
  • This is solved in http://stackoverflow.com/a/29691834/1845672 , which is based on the keyboard sequence tab-tab-rightarrow . – Roland Feb 15 '16 at 11:48

4 Answers4

2

I ended up using the Ookii dialogs folder browser dialog. Honestly it's just much better than the default folder browser. It also comes with an example, showing you how to use it.

NMunro
  • 1,282
  • 4
  • 18
  • 33
2

this works for me

folderBrowserDialog1.Reset();  
folderBrowserDialog1.RootFolder = Environment.SpecialFolder.MyComputer;
folderBrowserDialog1.SelectedPath = WorkingFolder;

but only after the second use of the dialog

oferb
  • 127
  • 1
  • 5
  • 1
    Not sure to me what you mean with '2nd use', but this did not work for me. Anyway, it doesn't hurt to use the first two inits before setting the SelectedPath. – Roland Feb 15 '16 at 10:49
0
    FolderBrowserDialog folderBrowser = new FolderBrowserDialog(); 
    folderBrowser.Description = "Select Chase 6 Installation Folder"; 
    folderBrowser.RootFolder = Environment.SpecialFolder.ProgramFiles; 
    folderBrowser.ShowNewFolderButton = false; 

    if (Directory.Exists(Properties.Settings.Default.defaultChasePath)) 
    { 
        string x = Properties.Settings.Default.defaultChasePath; 

        //Use API Flag to set correct path, following tahter a catch all better to check
        //enum for full list
        RootSetter.SetRootFolder(folderBrowser, RootSetter.CsIdl.FlagDontVerify);

        folderBrowser.SelectedPath = x;

    } 
    if (folderBrowser.ShowDialog(this) == DialogResult.OK) 
    { 
        string huz = folderBrowser.SelectedPath; 
    }

I got from this link

How do I open a FolderBrowserDialog at the selected folder?

Community
  • 1
  • 1
Pushpendra
  • 814
  • 1
  • 6
  • 17
-1

Set your selected path to the last folder path so that it will scroll down.

if (folderDialog.ShowDialog() ==  DialogResult.OK)
{
   Properties.Settings.Default.Path = folderDialog.SelectedPath;
   Properties.Settings.Default.Save();
}

Change the code inside if condition.

Pushpendra
  • 814
  • 1
  • 6
  • 17
  • Had no effect. The path I want is always highlight, and the tree is always opened to the right folder, it's just not always scrolling down. Sometimes it scrolls down, and sometimes it doesn't. – NMunro Sep 14 '12 at 18:40
  • You can also have look at this http://stackoverflow.com/questions/8404394/is-it-possible-to-make-a-folderbrowserdialogs-default-path-show-up-in-a-library – Pushpendra Sep 14 '12 at 18:48
  • One more link http://social.msdn.microsoft.com/Forums/en/csharplanguage/thread/e555bf10-3e7b-4c27-a0ee-da7886899b30 – Pushpendra Sep 14 '12 at 18:55
  • Still nothing. I tried changing the root to Desktop because it shows more options, and now it will never scroll down. – NMunro Sep 14 '12 at 19:14
  • have you checked the second answer – Pushpendra Sep 14 '12 at 19:22