Copying Files Using Tree Views
Let's try something a bit fancier. Add a menu choice to the Welcome form's menu named mnuFilesFileCopier
. Set its Text to File Copier
. The event handler for that menu choice will open the frmFilesCopier
form that you'll create to copy files
from a group of directories selected by the user to a single target directory or device, such as a floppy or backup hard drive.
Although you won't implement every possible feature, you can imagine programming this form so that you can mark dozens of files and have them copied to multiple disks.
Begin by creating the frmFilesCopier
form, then extending it to a size of 570,740
. Next, drag on three labels, a text box, two tree view controls, four buttons, and a checkbox, as shown in Figure 3-15.
Figure 3-15. File Copier design
Drag a StatusStrip
on to the form at the bottom. Click on the status strip's drop down (on the form) and chose StatusLabel
. Set the label's name to lblStatus
and set its Text to Ready
.
You want checkboxes next to the directories and files in the source selection window but not in the target (where only one directory will be chosen). Set the CheckBoxes
property on tvwSource
to true
, and on tvwTarget
to false
.
Once you've done this, double-click the Cancel button to create its event handler. The entire implementation for this event handler is to close the form without taking further action, as shown ...
Get Programming Visual Basic 2005 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.