mobile databases, mobile forms, and mobile synchronization … where you need to work
Providing Pocket Access, Mobile Database, Windows CE Database, and Windows CE Development Solutions

Tip of the Month (October 2003)

Using a Grid Control to Show All the Records in a Table

Starting in Visual CE 10.0 you can do this quickly and easily. When you create the grid (CONTROL | GRID), a dialog appears that asks you select a search key. On the bottom of the dialog, there is a checkbox labeled "Show all records". Just turn on that checkbox.

If you have an older versionof Visual CE...

Usually, a Grid Control shows records from another table that are related to the current record. For example, if you have a form over a CUSTOMER table, the Grid Control might show the orders for that customer.

But sometimes you would want the Grid Control to show all the records in the current table (in our example, all the CUSTOMER records).

To do this, add an integer column to your table called COLUMN_THAT_IS_ALWAYS_SET_TO_ONE. Create an index over that column. Whenever you create a record in the table, set COLUMN_THAT_IS_ALWAYS_SET_TO_ONE to 1. The form will do this automatically if you add an edit control to your form whose default value is 1.

During the creation of the Grid Control, use COLUMN_THAT_IS_ALWAYS_SET_TO_ONE as the key column and the form itself as the form to jump to.

When the form runs, Visual CE will take the value of COLUMN_THAT_IS_ALWAYS_SET_TO_ONE from the current record (i.e. 1), and then display all the records that have COLUMN_THAT_IS_ALWAYS_SET_TO_ONE set to 1 (i.e. all the records).