4.2. Design


There are two ways to approach a custom control of the complexity of the Rolodex. One is to build it incrementally; the other is to design it up front. I typically build incrementally, factoring out common code as I go. However, to present all the myriad iterations as functionality is added one step at a time would be a book in itself.

Thus, as an expedient, I'm going to build this as if I were omniscient, anticipating in advance a complete design that I can then implement.[*]

[*] The design and code for the applications in this book, especially the Rolodex custom controls , are based on work done by Liberty Associates, Inc. on behalf of and owned by Catalyst, Inc. (http://catalystwomen.org/), and are used with their generous permission.

Your Rolodex will be housed in forms. You will have a Rolodex form for Customers, a second Rolodex form for Suppliers, and one each for Employees and Orders (you'll only implement Customers here; the others will be left as an exercise).

These four forms will all derive from a common base form, frmRolodex. The job of frmRolodex will be to hold the code and design common to all the derived forms.

Within each of these forms will be a Rolodex panel. The job of the panel will be to:

  • Display all the buttons (a-z)

  • Display twelve Rolodex entries at a time

  • Display the scrollbars

The Rolodex panel is shown in Figure 4-2.

Figure 4-2. Rolodex panel


Within the panel are Rolodex entries. You'll design a MustInherit base class, RolodexEntry, and then you'll derive classes (like RolodexCustomerEntry) from it. These classes will specialize what information goes in the entry. For Customers, you want the customer name, contract, phone, and fax. For suppliers, Employees, and Orders, you'll want different information.

In summary, for this chapter, you'll build the following:


frmRolodex

The base class for all forms using a Rolodex


frmCustomerRolodex

Derives from frmRolodex, holds the customer Rolodex


RolodexPanel

Holds Rolodex entries, scrollbar, and A-Z buttons


RolodexEntry

The base class for all entries in the Rolodex panel


RolodexCustomerEntry

Derived from RolodexEntry, specialized for customers

To simplify project management, the forms will be kept in the NorthWindWindows project, but the custom controls (RolodexPanel, RolodexEntry, and RolodexCustomerEntry) will be in a new project named NorthWindControls. Both the NorthWindWindows project and the NorthWindControls project will be housed within the NorthWindWindows solution, thus making it easy for the projects to be kept together and managed as a single development effort.



Programming Visual Basic 2005
Programming Visual Basic 2005
ISBN: 0596009496
EAN: 2147483647
Year: 2006
Pages: 162
Authors: Jesse Liberty

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net