SAMPLE: Gridtest.exe Sample Grid Does Not Refresh Properly

ID: Q176093

The information in this article applies to:

SUMMARY

Gridtest.exe contains an example that demonstrates using a grid based on two data sources. The sample shows that the grid may not display properly when you navigate the master table with a custom toolbar while the focus on the main form is in the grid.

MORE INFORMATION

The following file is available for download from the Microsoft Software Library:

 ~ Gridtest.exe (size: 35143 bytes) 

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119591
   TITLE     : How to Obtain Microsoft Support Files from Online Services

Symptoms

Under the following conditions, a grid based on two tables will not display the correct data:

Whether or not the scroll thumb or the scroll arrows are used to scroll the grid determines how the data is misrepresented. In either case, the records from the second table are misrepresented.

Resolution

Here are two possible workarounds:

NOTE: If the navigation buttons are objects on the form, this problem does not occur.

Status

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

Steps to Reproduce Behavior

1. Using the sample file run the form named Broken.

2. Click the Next button located on the form. All the visible cells in the

   first column of the grid should contain the number 2. Note that if
   the grid is scrolled with either the scroll thumb or scroll arrows, all
   the grid columns display correctly. The example below demonstrates
   how the data should be displayed in the grid. The last row will not be
   visible.

      TBL2.F1   TBL2.F2   TBL3.F2   TBL3.F3
      -----------------------------------------

      2         a         a         Red
      2         b         b         Blue
      2         c         c         Green
      2         d         d         Yellow
      2         e         e         Brown

3. Click in any cell of the grid. The grid now has focus on the form.

4. Click the Previous button on the Toolbar, not the form.

5. Scroll down the grid with the scroll thumb or slider. All the records in

   the third column (TBL3.F2) will contain the letter "a." "Red" appears in
   all the records of the fourth column (TLB3.F3).

   Scroll down the grid with the scroll arrow. All the records in the third
   column (TBL3.F2) will contain the letter "d." "Yellow" appears in all
   the records of the fourth column (TLB3.F3).

   Using the scroll thumb, scroll arrows, or clicking in one of the grid
   cells does not cause that cell to refresh properly.

   NOTE: The results of this step may be inconsistent and differ from what
   is described here. What should be displayed is the example shown in step
   2 above with the number 1 in the first grid column for all rows.

6. Make sure that the focus is not in either the third or fourth grid
   column, and then click the Grid Refresh button on the form. The grid
   should now be back to normal. If one of the cells in the third or fourth
   column had focus, it will not refresh, but all the others will. This
   step implements the second workaround described in the Resolution
   section above.

7. Click in one of the grid cells, and then click the Next button on the
   toolbar. The grid should move so that the number 2 is in the first
   column (TBL2.F1). The data in the third and fourth columns should be
   correct. Refer to the grid in step 2 above. Note that the last row
   is not visible.

8. Scroll the grid using the down scroll arrow. Note the values in the
   third and fourth columns for the first visible record when you finish
   scrolling.

   If the scroll down was stopped, with only the last two records
   displayed, and then the up scroll arrow is clicked, all the records
   displayed from TBL3 will have the correct information. The example below
   demonstrates how the data should be displayed in the grid.

      TBL2.F1   TBL2.F2   TBL3.F2   TBL3.F3
      --------------------------------------

      2         a         d         Yellow
      2         b         d         Yellow
      2         c         d         Yellow
      2         d         d         Yellow
      2         e         e         Brown

   If only the last record was visible when scrolling down stopped, then
   all the records will contain an "e" in the third column (TBL3.F2)
   and "Brown" in the fourth column (TBL3.F3) of the grid when
   scrolling up.

9. Modify the GridTtest.pjx sample project and examine the code in the
   forms and visual classes.

Additional query words: Grid Display Keywords : kbfile kbsample kbDesigner kbVFp500 kbVFp600

Last Reviewed: October 23, 1998