0
Good people, I’d like a little help
I made a file explorer that aims to map all folders, subfolders and files of these folders and subfolders according to the letter that is selected.
The problem is that when selecting any letter, the program shows the folders that start by the selected letter and always shows any files that are not inside a folder, on the desktop.
The result looks like this:
The function I used to show the folders and subfolders and the files of both, is this
var directoryNode = new TreeNode(directoryInfo.Name);
var directoryNode = new TreeNode(directoryInfo.Name);
foreach (var directory in directoryInfo.GetDirectories(letra))
directoryNode.Nodes.Add(CreateDirectoryNode(directory, letra));
foreach (var file in directoryInfo.GetFiles())
directoryNode.Nodes.Add(new TreeNode(file.Name));
return directoryNode;
How can I make so that when selecting the letter, only folders, subfolders and files of both appear ? Thanks for the help
What seems to be missing is the code to insert the files, just add to the tree, the files starting with the letter. You have to put an If.
– Renato Afonso
@Renatoafonso, then, I putting an if for each letter, I would eliminate the problem of showing the desktop files, which are not inside a folder ?
– Agner Ribeiro