打开文件对话框/ C#中的任何文件缓慢。更好的解决方案? [英] OpenFileDialog/c# slow on any file. better solution?

查看:217
本文介绍了打开文件对话框/ C#中的任何文件缓慢。更好的解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打开在C#中使用的OpenFileDialog一个文件,我注意到它是20-40秒之间采取载入我的文件并清除该对话框。

I am opening a file using the OpenFileDialog in c# and I am noticing it is taking between 20-40 seconds to load my file and clear the dialog.

下面是我的示例代码:

private void btnOpen_Click(object sender, EventArgs e)
{
    if (ofdSettings.ShowDialog() == DialogResult.OK)
    {
         // do nothing
    } 
}

即使在这种有限的例子花费对话框清除20-40秒时间。
我肯定选择该文件是一个XML文件,它仅仅是1.36kb大

even with this limited example it takes the 20-40 second duration for the dialog to clear. the file i'm selecting is a xml file that is only 1.36kb large

推荐答案

我有同样的问题,openFileDialog1.ShowDialog()很慢,用10秒钟关闭它来执行我的计划的下一行。
我在对话框中注意到,我有一对夫妇的老快捷方式计算机下,指向的WebDAV的URL这已不再有效。我删除从Windows资源管理这些快捷方式,程序,现在是快。
检查,如果您有任何网络连接的快捷方式连接到您的计算机,这也显示在对话框中(在Windows 7中的左侧面板上)。试图删除它们,看看对话框更快。

I had the same problem, openFileDialog1.ShowDialog() was slow, taking 10 seconds after closing it to execute the next line of my program. I noticed in the dialog that I had a couple old shortcuts under "Computer" pointing to webdav url's which were no longer valid. I deleted these shortcuts from windows explorer, and the program is fast now. Check if you have any network connection shortcuts tied to your computer, which also display in the dialog (on the left-hand panel in Windows 7). Try removing them and see if the dialog is faster.

这篇关于打开文件对话框/ C#中的任何文件缓慢。更好的解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆