i needed to filter out the whole computer and find only .sto files. I want theses files displayed in a listbox. I am needing them displayed like this: “text.sto”. I am using Visual C# Express. How do i do that?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Make sure you have this using directive at the top of your code file:
Get the directories with this method:
It takes a second parameter that allows you to filter the results. More information on the method can be found here: http://msdn.microsoft.com/en-us/library/ms143316.aspx
Incase you do not want to use the built in .Net function for this (because it can throw access errors and provide no results), here is a answer to the question that shows doing it a different way: https://stackoverflow.com/a/929418/184746
Referencing from the aforementioned article, here is a method that will catch and wont give you errors with filtering added for *.sto:
You can use it like this:
After that, create a listbox in the designer, and iterate through and add the items
Out of curiosity, what was your search parameter when researching this? Because a simple google search reveals all you need:
"get list of files C#"https://www.google.ca/search?sourceid=chrome&ie=UTF-8&q=get+list+of+files+C%23