Chapter 1. Design and First Forms

In this chapter you will begin to create a Windows application. You will find that we get down to business immediately with as little fuss as possible. The introductory comments are intended to set the stage for everything else we're doing. I'll keep them short.

The requirements for a meaningful Windows application will be spelled out in this chapter, and the rest of the book will focus on implementing that application. We will finesse the design, exploring design decisions as we go, and our general approach will be that of successive approximation; that is: get it working and keep it working, as you add new functionality.

At times, this approach will cause us to write and rewrite the same section. One could argue that had we designed in advance we would avoid those cul-de-sacs, but it is exploring these dead ends, and the improvements we can make as we progressively improve our product, that will bring out essential aspects of Visual Basic 2005 programming.

The Requirements

Over the course of part one of this book, we will create an application based on a real-world application I recently built for one of my clients. We will use the application to explore retrieving and updating data from the Northwind Database that comes with SqlServer and SqlExpress.

Tip

At the time of this writing, Microsoft is urging that .NET applications use SqlExpress in preference to Access, and so we shall in this book, though converting the code to support an Access database should not be difficult.

The opening form for the application allows you to search for or display all the Customers, Orders, Suppliers, and Employees listed in the Northwind tables, as shown in Figure 1-1.

Initial form

Figure 1-1. Initial form

The details page provides details on one company. It is tabbed and has a menu item, as shown in Figure 1-2. (Actual fields to be displayed will correspond to what is in the database.)

Customer detail

Figure 1-2. Customer detail

This form will be used to demonstrate menus, events, data display, data binding, data updating, and so on.

If you click All Customers from the main menu, you will be brought to a custom Rolodex®, as shown in Figure 1-3.

All Customers Rolodex

Figure 1-3. All Customers Rolodex

The user can scroll through all the customers or click on a letter to advance immediately to customers whose name begins with that letter. This will show a fairly sophisticated custom control, as well as advanced use of inheritance and polymorphism, as we reuse the basic structure of the Rolodex to be able to scroll through both customers and suppliers.

Double-clicking the customer entry in the Rolodex will bring you to the details page (as shown earlier).

You'll create the Rolodex in Chapter 4.

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.