Creating a Windows Forms Application
To see how Windows Forms can be used to create a more realistic Windows application, in this section you’ll build a utility named FileCopier that copies all 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 on the company network. Although you won’t implement every possible feature, you can imagine programming this application so that you can mark dozens of files and have them copied to multiple disks, packing them as tightly as possible. You might even extend the application to compress the files. The true goal of this example is for you to exercise many of the Visual Basic .NET skills learned in earlier chapters and to explore the Windows.Forms namespace.
For the purposes of this example and to keep the code simple, you’ll focus on the user interface and the steps needed to wire up its various controls. The final application UI is shown in Figure 13-9.
Figure 13-9. The FileCopier user interface
The user interface for FileCopier consists of the following controls:
Labels: Source Files and Target Directory
Buttons: Clear, Copy, Delete, and Cancel
An “Overwrite if exists” checkbox
A text box displaying the path of the selected target directory
Two large tree view controls, one for available source directories and one for available target devices and directories
The goal ...
Get Programming Visual Basic .NET, Second Edition 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.