Setting the initial directory of an SaveFileDialog?

前端 未结 14 2161
一个人的身影
一个人的身影 2020-12-01 10:05

I\'d like a SaveFileDialog with the following behavior:

  • The first time you open it, it goes to \"My Documents\".

  • Afterwards, it goes to the

14条回答
  •  情话喂你
    2020-12-01 11:03

    I too have tried different "solutions" found in different places, but none of them seem to work as soon as there is an MRU list entry in the registry :/ But here is my own simple workaround…

    Instead of setting the dialog's InitialDirectory property, set the FileName property to your path, but combined with the selected Filter, e.g.:

    dialog.FileName = Path.Combine(myPath, "*.*");
    

提交回复
热议问题