Step 5 - Building the User Interface
As this is not intended to be a User Interface development guide, we will focus on three main issues: Table control, Common techniques, and a brief description of the sample program's user interface.
Table Control Dynamic SQL link
The table control can be filled directly from a Command object. To do this, use the ExecuteTable method. You have to have a table control in your code. This command deletes everything from the table, and then fills it. Column names are the names of the fields in the database. Cell values are the values entered to the database. A common mistake is to use this table with a huge amount of rows: this control is not planned to work smoothly with more than a couple of thousands rows in it.
Sample code UI design
The User Interface in the sample code consists of one module, and three forms:
Form1: entering the program

Form1 holds three buttons, acting as a menu: New order, calling the Order form, and two buttons causing a list to show: the first displays all orders, and the second displays opened orders only (not served). Both direct the application to the List form.
frmOrder: the Order form

The order form holds the user interface required to enter order data.
Note:
1. Same form is used for updating and adding records. The decision whether to call add or update is made when closing the form. The decision whether or not to fill the controls with data is made when entering the form. A global structure, named order, is used to save the state of the application at each point.
2. Deleting is done from here by raising the delete sub.
frmList: the lists form

This form is used in order to select the desired order for extra details. User interface here is very basic, but very easy to implement. Pressing the Details button moves us to the order form, this time with details filled.
Common UI techniques
Common tasks implemented here are:
1. Using a global variable - named order - as the application "working order". This variable is used to return data from the Subs to the forms.
2. Calling the Business logic Subs with all details for code saving.
3. Updating the database only when clicking "Confirm". Do not try to follow minor changes the user does with each of the fields: instead, display an input form, wait until he makes up his mind and update everything at once.
Next page: Deploying