NET中的DirectoryInfo

NET中的DirectoryInfo

本文介绍了VB.NET中的DirectoryInfo.GetFiles回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我承认,我不是VB.NET专家,我还在学习,但是已经运行了一个烦人的问题。我正在编写一个程序,必须搜索文件

系统,因此处理大量的目录和文件。我已经找到了DirectoryInfo(这很简单),但是当我调用

DirectoryInfo.GetFiles(甚至是DirectoryInfo.GetDirectories)时,它可能需要

永远。一些目录中有数千个文件。


所以,我的应用程序只是坐在那里,用户认为它被锁定了。


我正在寻找一种从GetFiles函数获取回调的方法,这样我实际上可以提供合理的进程条。我知道我可以闪现一个

进度条或其他东西,但我希望这些信息有意义。


有人能指出我正确的方向。欢迎提供示例代码,创意,任何

建议。


提前感谢您的帮助。我在询问

之前进行了搜索和搜索,但似乎无法找到我要找的东西。


Tom

OK, I admit, I am not a VB.NET expert and am still learning, but have run
into an annoying problem. I''m writing a program that has to search the file
system and therefore processes large numbers of directories and files. I''ve
figured out DirectoryInfo (it''s pretty simple), but when I invoke
DirectoryInfo.GetFiles (or even DirectoryInfo.GetDirectories), it can take
forever. Some of the directories have thousands of files in them.

So, my application just sits there and the user thinks it''s locked up.

I''m looking for a way to get a callback from the GetFiles function so that I
can actually provide a reasonable processbar. I know I could just flash up a
progress bar or something, but I want the information to be meaningful.

Can someone point me in the right direction. Sample code, ideas, any
suggestions would be welcome.

Thanks in advance for the help. I''ve searched and searched prior to asking
but can''t seem to find what I am looking for.

Tom

推荐答案






你会在这里找到一个很好的样本(注意样本是用
C#编写的,必须先翻译成VB.NET才能在VB.NET中使用):


< http ://www.palmbytes.de/content/dotnetlibs/filesearchlib.htm>


-

Herfried K. Wagner [MVP]

< http://www.mvps.org/dotnet>



You will find a nice sample here (notice that the sample is written in
C# and must be translated to VB.NET before it can be used in VB.NET):

<http://www.palmbytes.de/content/dotnetlibs/filesearchlib.htm>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>



我有




that I


了一个


询问




这篇关于VB.NET中的DirectoryInfo.GetFiles回调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 08:47