Click here to Skip to main content
15,906,816 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i am trying to make a file picture converter program but when i use this code it only finds folders not anything else; how do i make this open programs/pictures?

What I have tried:

FolderBrowserDialog fdb = new FolderBrowserDialog();
if (fdb.ShowDialog() == System.Windows.Forms.DialogResult.OK)
textBox1.AppendText(fdb.SelectedPath);
Posted
Updated 19-Jul-18 17:44pm

You need to get a "list" of the file (names) in the selected folder; then load each file for processing.

c# - How to loop through all the files in a directory in c # .net? - Stack Overflow[^]
 
Share this answer
 
Comments
Member 13915301 19-Jul-18 16:59pm    
please can you make an example? thanks
phil.o 19-Jul-18 17:25pm    
You can find usage's description here:
Directory.GetFiles Method[^].
There is also a clear example in the link Gerry provided you.
Eric Lynch 19-Jul-18 20:28pm    
One thing, I suggest using Directory.EnumerateFiles. With Directory.GetFiles, you can't start doing anything until the information for ALL files has been loaded. With Directory.EnumerateFiles, you can process the file information as its discovered. The signatures are nearly identical, but it can make a big performance difference for directories with large numbers of files. Of course, this assumes that the caller doesn't do something dumb like tack a ToArray/ToList onto the IEnumerable :)
Maybe you should try the OpenFileDialog instead of the FolderBrowserDialog.
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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