FIX: Programmatic Change in Grid Does Not Update ControlSource

Last reviewed: October 29, 1997
Article ID: Q139865
3.00 5.00 WINDOWS kbprg kbbuglist kbfixlist

The information in this article applies to:

  • Microsoft Visual FoxPro for Windows, version 3.0, 5.0

SYMPTOMS

When trying programmatically to change the value in a text box that is contained in a grid, you discover that the underlying data is not updated.

WORKAROUND

To work around the problem, use a REPLACE statement to change the underlying data, and use the REFRESH method to update the grid.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual FoxPro 5.0 for Windows.

MORE INFORMATION

Steps to Reproduce Problem

  1. Open the Testdata.dbc database found in the \Vfp\Samples\Data directory.

  2. Create a new form.

  3. Add the Customer table from the Testdata database to the Data Environment of the form.

  4. Add a grid by dragging the Grid icon from the Form Controls toolbar onto the form.

  5. Set the RecordSource property of the grid to the Customer table.

  6. Add a command button to the form.

  7. Add the following code to the Command1 Click event procedure:

          thisform.grid1.column2.text1.value='Hello World'
          thisform.grid1.refresh
    

  8. Save the form as Test.scx, and run it.

  9. Click the Command1 button. You will notice that the grid does not have the new value in the Company field.

Place the following code in the Command1 Click event to work around the problem and place the correct value in Grid1:

   REPLACE (thisform.grid1.column2.text1.controlsource) WITH 'Hello World'
   thisform.grid1.refresh


KBCategory: kbprg kbbuglist kbfixlist kbcode
KBSubcategory: FxprgGrid VFoxWin buglist3.00 fixlist5.00
Additional reference words: 3.00 5.00
Keywords : buglist3.00 fixlist5.00 FxprgGrid vfoxwin kbbuglist kbcode kbfixlist kbprg
Version : 3.00 5.00
Platform : WINDOWS
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 29, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.