Click here to Skip to main content
15,179,476 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm creating a windows application form in C# which should display a particular type of file ( say *.tmp for example ) recursilvely. When I click on a Button in the form; the search should begin to search all *.tmp files. The LabelBox should display the path of a file being scanned and whenever a *.tmp file is found; the other labelbox cound should increase.

I tried using EnumerateFiles but I go an error message System.IO.Directory does not contain EnumerateFiles.
I tried GeFiles but with this we can display the progress of scan in LabelBox I think.

Can any help me how to show each file or path being scanned in the labelbox of a form and for each successfull search of *.tmp the other labelbox cound should increase. The UI should like that; the actual users should see which file or path is being scanned and they should see te increase in cound of the labelBox2.

Thank you.
Posted

Use Directory.GetFiles[^] to create a list of files in a directory. You can then add them to a ListBox and process them in any order you choose.
   
using below api you can directly get the search result.

to simulate this operation and to show user some progress you can collect all the files using belwo API and then iterate through it by showing current folder path of file and the indexer progress.

https://msdn.microsoft.com/en-us/library/ms733069(v=vs.110).aspx[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900