Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hi,

 

is there any way I can do a search for a file from withing a C# program? (I know the exact filename)

At that time, I should be able to show an endless progress-bar, just like with the search function in windows explorer.

 

thanks in advance!

  • *Gurus*
Posted

You can use the GetDirectories and GetFiles methods of the System.IO.Directory class to enumerate the folders and files in any directory. If you use this recursively this can enable you to search an entire drive. Ideally you should do this in a new thread (or call Application.DoEvents() periodically in the loop) since this will be an expensive operation in terms of both cpu and disk usage.

 

The Windows Forms progressbar doesn't wrap the "infinite progress bar" appearance available under Windows XP, so you'll have to either implement that manually (consult MSDN for the window style) or do something different.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...