Microsoft KB Archive/134436

= FIX: After Removing Text in Grid Other Data Appears Truncated =

Article ID: 134436

Article Last Modified on 9/30/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition

-



This article was previously published under Q134436



SYMPTOMS
After you add an edit box as a control to a grid column and delete some of the text in the edit box, the text in the other records in this column appear to be truncated to the new length of the text in the edit box.



WORKAROUND
Set the Sparse Property for the grid column that contains the edit box to True (.T.).



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
This behavior happens whether the grid is created using the Grid Builder or manually in the Form Designer.

Steps to Reproduce Problem
NOTE: To understand the following steps, you need working knowledge of the Visual FoxPro Form Designer. See Chapter 9 of the Microsoft Visual FoxPro "Developer's Guide" for more information on working with the Form Designer.  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 object to the form.  Set the following properties for the grid, and resize it as desired. ColumnCount=3 RecordSource=Customer RowHeight=45  Add an Editbox control to either column 2 or 3 (or both) of the grid. To do this, follow these steps:

<ol style="list-style-type: lower-alpha;"> Click the form to make sure it is active.</li> Click the grid to select it.</li> Using the right mouse button, click the grid to bring up the shortcut menu, and click Edit from this menu.</li> Click the Editbox control icon on the Form Controls toolbar.</li> Click the grid column where you want to put the Editbox. Any cell in that column will do.</li></ol> </li>  Set the following properties for the column(s) that the Editbox control was placed in (assume it is column 2 for this example): CurrentControl=Edit1 Sparse=.F.  ControlSource=Customer.company </li> For the other columns in the grid (columns 1 and 3 for this example), set the ControlSource property to a field from the Customer table. Customer.cust_id and Customer.contact will work fine for this example.</li> Save and Run the form.</li> The text in the second column of the first record should be "Alfreds Futterkiske." Delete the "Futterkiske" portion of the text, and press the TAB key a few times to force the grid to refresh. The other entries in the second column should truncate (for display purposes only) at the length of the word "Alfreds," which was what was left in the edit box in the first record.</li></ol>

The grid can also be designed by clicking Builder on the shortcut menu displayed in Step 6.c above. In the Layout tab of the Builder dialog box, set the Control Type for column 2 to be Editbox.

<div class="references_section">