"Build a Scalable Architecture" by Kathleen Dollard
Visual Studio Magazine, July 2002

Windows.Forms DataBinding Demo

*** Contents

This solution consists of four projects

- NorthwindTest contains the Windows.Forms forms

The Main form uses reflection to add any forms in the project to the menu and shows how easy it is to add a thread wide global exception handler. 
The Customers form contains the databinding samples

- NorthwindDataSets contains the XSD files, strongly typed DataSets, and Extended Strongly Typed Datasets (ESTD)

The XSD files were generated via drag/drop. The strongly typed DataSets were then created via Generate Dataset. The ESTD was manually created.

- NorthwindDataAccessor

The CustomerOrderDataAccessor is a component that provides the objects that access data. These were created via Drag/Drop. A simplified version is also included in the project and there is some common code in the Support.vb file.

- DataGridColumnStyle

This contains a fairly simple version of providing a DataGridColumnStyle class for use in Windows.Forms Datagrids. You will have to assign this column style in code runtime, as demonstrated in the NorthwindTest Customers form.

*** Overview

While this code should run via the framework, it was tested through Visual Studio. As written, it requires SQLServer or MSDE. If you wish to change to OLEDB, all changes will occur in the NorthwindDataAccessor project. 

To run the project, you will have to modify the SQLConnection in the CustomerOrderDataAccessor component to reflect a password valid on your server or change to integrated security. Alternativley, you could create and use a config file with this information.

When you run the project, press the open icon to load the form with data. Please notice

1) The toolbar includes an updated version of the VB6 data control
2) As you move through the records, only the orders for the current customer are displayed
3) The shippers are a combo box lookup on a numeric column
4) Typing a 9 in the ContactName field displays an error icon and text. Move through records to note that this is only displayed on the record containing the error
5) The two combo boxes behave quite differently simply because one (cboPos in the toolbar) has its data and content bound to the same currency manager, while the other (cboCountry) binds to two different currency managers.

Kathleen Dollard
April 18,. 2002
