FolderBrowserDialog RootFolder

Trying to set the default folder in FolderBrowserDialog  to C:\

FolderBrowserDialog1.RootFolder = My.Computer.FileSystem.CurrentDirectory = "C:\"

   results in starting at Desktop.

FolderBrowserDialog1.RootFolder = Stringvalue

   results in Cast problem string to integer.

 

In the similar OpenFileDialog InitialDirectory

OpenFileDialog1.InitialDirectory = StringValue

   works OK.

Is there a way to start at "C:\" in FolderBrowse

Thanks

 

 



Answer this question

FolderBrowserDialog RootFolder

  • LSDeans

    The folderbrowserdialog's rootfolder accepts a specialfolder value not a string that is why you get the error. There is no specialfolder value for c:\. Here is an example of a valid entry

    FolderBrowserDialog1.RootFolder = Environment.SpecialFolder.Personal


  • FolderBrowserDialog RootFolder