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.
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 doesnt wrap the "infinite progress bar" appearance available under Windows XP, so youll have to either implement that manually (consult MSDN for the window style) or do something different.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.