The aim is to create an application which (enhanced windows explorer) consists a tree view where someone can see the files available in the existing drives up to certain levels. (In this case 4). You can easily change it to any level you want. Also when someone selects a file from the tree view, we need to display the different properties of this file in the labels in the group box. Then when he user selects some file and presses the Compress button, the file gets compressed and like wise it is to be decompressed.I create a windows application with a tree view showing the files in the drives as in fig 1.The user can expand the up to 4 levels to see the files/directories.The details of the selected file or folder like the file name, date created, size etc are shown in the labels in the Details groupBox. (See Figure 1).Also the Data GroupBox contains a multi-line text box which shows the contents of the selected file.Figure 1.This function quits after 4 levels of any branch, actually windows explorer does the same thing. Initially its load only couple of levels and when you click on some branch its reload that branch to deep levels.If you try o load all the level, then its going to take up to 2-5 minutes depending upon your machine speed.private void FillDirectory(string drv, TreeNode parent, int level){try{// I want to go only upto 4 level.level++;if (level > 4)return;DirectoryInfo dir = new DirectoryInfo(drv);if (!dir.Exists)throw new DirectoryNotFoundException("directory does not exist:"+drv);foreach(DirectoryInfo di in dir.GetDirectories()){TreeNode child = new TreeNode();child.Text = di.Name;parent.Nodes.Add(child);FillDirectory(child.FullPath, child, level);}}catch(Exception ex){ex.ToString();}}
Figure 2.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: