相关疑难解决方法(0)

为什么OpenFileDialog会改变我的工作目录?

为什么OpenFileDialog会改变我的工作目录?我应该假设System.Windows.Forms中的许多func会改变我的工作目录吗?

    OpenFileDialog open = new OpenFileDialog();
    open.Filter = filter;
    a = Directory.GetCurrentDirectory(); //<-- correct
    if (open.ShowDialog() == DialogResult.OK) //-- select a file on my desktop
    {
        a = Directory.GetCurrentDirectory(); //<-- incorrect, is set to my desktop
Run Code Online (Sandbox Code Playgroud)

.net openfiledialog

15
推荐指数
4
解决办法
1万
查看次数

OpenFileDialog and Environment.CurrentDirectory

After using the OpenFileDialog for selecting a file the Environment.CurrentDirectory changes to the folder of the file. Is this normal?

From my understanding Environment.CurrentDirectory should always be the application folder.

c#

2
推荐指数
1
解决办法
6078
查看次数

标签 统计

.net ×1

c# ×1

openfiledialog ×1