You need to show a directory tree with the TreeView control, but filling the directory tree structure at startup is too time consuming.
React to the BeforeExpand event to fill in subdirectories just before they are displayed.
You can use the recursion technique shown in recipe Process Files Recursively to build an entire directory tree. However, scanning the file system in this way can be slow, particularly for large drives. For this reason, professional file management software (and Windows Explorer) use a different technique—they query the necessary directory information when the user requests it.
The TreeView control, shown in Figure 5-1, is particularly well suited to ...