A grid is a matrix of data fields. Each element of this matrix, called a cell, can hold either text or a bitmap, or both. Grids are organized into rows, columns, and records. In a grid, a row is a grouping of cells that appear on one line in the control. A record is one or more rows that are treated as a logical unit. By default, a record occupies one row in a grid, but a record may also wrap around to the next row when it passes the right edge of the grid. A column identifies a particular cell in a record.
A grid's capacity is limited by available memory. Sometimes, however, you may want to view many records using a grid control. This could pose a problem when you are using normal grids. Just loading all the records into the grid could take an excessive amount of time. To remedy this problem, you may want to use a paged grid.
When you are using the PAGED style in a grid, the grid holds only as many records as can be viewed on the screen. This is called a page of data. The vertical scroll bar found in a normal grid is replaced by four buttons. These buttons respond to requests to get the next record, the previous record, the next page, or the previous page. (Note that you can also apply wheelmouse events to PAGED styled grids.) When the user clicks one of these buttons, the grid sends a message to the program asking for the appropriate data depending on which button was clicked. This data typically comes from an indexed file. The expected program logic is to do one or more READ NEXT or READ PREVIOUS statements to retrieve the data.
Paged grids are conceptually similar to paged list boxes. Programmers familiar with paged list boxes, however, may notice some differences in programming paged grids. These differences were designed to make programming the grid's paging logic easier. The noticeable differences are:
Furthermore, paged grids communicate requests for more data through events such as:
Paged grids never hold more data than they can display on the screen. When you are adding a record at the end of a full page, the control deletes the topmost non-heading record. This causes the grid's contents to scroll upward. When you are adding a record to any other position, the last record in the grid is deleted. This causes all records after the one being added to scroll downward.