Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.20/5 (2 votes)
hello

in one of my application i want to show the directories, sub directories and files which is present in a remote computer through winforms. is ther any control to accomplish this ??

and also before populating it to a controll i would like to store the info of dir, subdir and files in list. i am working on custom list of classes but failed.. is ther any alternate solution for this ??

thank u
Posted
Updated 6-Apr-15 18:58pm
v2
Comments
Sergey Alexandrovich Kryukov 7-Apr-15 1:29am    
You cannot store anything to a generic list. Generic type is generic, if first can be instantiated into a complete type, and only a complete type can be instantiated into an object, type instance.
"But failed" is not informative. What have you tried so far?
—SA
vikaskallidantheyil 7-Apr-15 1:43am    
sorry
i tried to create a class like this
public class Dir
{
List directoryinfo SubDirInfo;
List fileinfo FileInfo;
}
and i made a list of this
List dir Dirs;
but it traverse only one step.. i want the files and dirs in the subdir also...

1 solution

In order to store subdirectories, you have to use the appropriate overload which reads all files, or arrange your Dir class to both store hierarchical information (by containing a list of Dir instances) and recursively parse the folders to build up the information.

However, you will not necessarily be able to access the remote files and folders anyway - only public shared folders are available under normal circumstances.
 
Share this answer
 

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