FIX: Programmatic Change in Grid Does Not Update ControlSource
ID: Q139865
|
The information in this article applies to:
-
Microsoft Visual FoxPro for Windows, versions 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
- Open the Testdata.dbc database found in the \Vfp\Samples\Data directory.
- Create a new form.
- Add the Customer table from the Testdata database to the Data
Environment of the form.
- Add a grid by dragging the Grid icon from the Form Controls toolbar onto
the form.
- Set the RecordSource property of the grid to the Customer table.
- Add a command button to the form.
- Add the following code to the Command1 Click event procedure:
thisform.grid1.column2.text1.value='Hello World'
thisform.grid1.refresh
- Save the form as Test.scx, and run it.
- 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
Additional query words:
Keywords : kbcode kbVFp kbVFp500fix buglist3.00 FxprgGrid
Version : 3.00 5.00
Platform : WINDOWS
Issue type :