Tomba Posted August 27, 2003 Posted August 27, 2003 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! Quote
*Gurus* divil Posted August 27, 2003 *Gurus* Posted August 27, 2003 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. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.