

GetDirectories(info.GetDirectories(), rootNode) Private void GetDirectories(DirectoryInfo subDirs,įoreach (DirectoryInfo subDir in subDirs)

Implement the code to populate the TreeView with nodes and subnodes. Set the SmallImageList property to imageList1. Open the ColumnHeader Collection Editor by clicking the ellipses ( ) in the Columns property**.** Add three columns and set their Text property to Name, Type, and Last Modified, respectively. In the Properties window for listview1 do the following: Set the ImageList property to imagelist1.Īdd a ListView control named listView1 to the form, and position it on the right side of the SplitContainer control. In the Properties window for treeView1 do the following: A new Windows Forms project is created.Īdd a SplitContainer control to the form and set its Dock property to Fill.Īdd an ImageList named imageList1 to the form and use the Properties window to add two images: a folder image and a document image, in that order.Īdd a TreeView control named treeview1 to the form, and position it on the left side of the SplitContainer control. In the list of templates, choose Windows Forms Application.Ĭlick OK. In the categories, choose either Visual Basic or Visual C#. In the New Project dialog box, do the following: On the File menu, point to New, and then click Project. To create the form containing a ListView and TreeView control Windows Explorer displays a hierarchical structure of the files and folders on a user's computer. A common scenario is creating a user interface (UI) with ListView and TreeView controls that resembles the Windows Explorer feature of Windows operating systems.

One of the benefits of Visual Studio is the ability to create professional-looking Windows Forms applications in a short of amount of time.
