Open/Save File Dialog

Alec Pointer 20 Reputation points
2023-02-13T08:00:06.07+00:00

Hi

I remember there was a feature in Open/Save File Dialogs allowing them to have separate startup folders, so new instance of all SaveFileDialogs will follow their own last opened folder on startup and the same for OpenFileDialogs...

But can't find it now, any tip? :)

Update: oops found it:

https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.filedialog.clientguid?view=windowsdesktop-7.0&viewFallbackFrom=netframework-4.0

But not for .net fw 4 or even 4.8?! So any workaround to have separate startup folders for Save and Open dialogs application wide?

Developer technologies VB
Developer technologies C#
{count} votes

2 answers

Sort by: Most helpful
  1. Jiachen Li-MSFT 34,221 Reputation points Microsoft External Staff
    2023-02-14T01:30:13.47+00:00

    Hi @Alec Pointer ,

    FileDialog.InitialDirectory Property set the default directory.

    FileDialog.RestoreDirectory Property set whether to save the last opened directory.

        openFileDialog1.InitialDirectory = "c:\"
        openFileDialog1.RestoreDirectory = True
    

    Best Regards. 

    Jiachen Li 

    ---------- 

    If the answer is helpful, please click "Accept Answer" and upvote it. 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.   

    1 person found this answer helpful.
    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.