Microsoft KB Archive/127843

= How to Place a Command Button in a Grid Cell Visually =

Article ID: 127843

Article Last Modified on 8/24/1999

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition

-



This article was previously published under Q127843



SUMMARY
This article shows by example how to place a command button in a grid cell by using the Form Designer. These steps may also be used to place other Visual FoxPro controls in grid cells.



Step-by-Step Example
 Open a new form. From the File menu, choose New. Then select Form and click the New File push button. Place a new grid on the form by clicking the Grid Tool on the Form Controls Toolbar and then drawing the box for the Grid on the Form. On the Properties Sheet, under the All tab, change the ColumnCount property to 2. (This example will provide a 2 column grid.) Select Column1 from the Object DropDown in the Properties sheet. Change the Sparse property to .F. if you want the command button to appear on every row no matter where the cursor is. Leave the Sparse Property set to the default of .T. if you want the command button to appear only on the row the cursor is on. With Column1 still selected, click the command button tool on the Form Controls Toolbar. Then click any row in Column1. On the Properties sheet, you should see that the Object Command1 is selected. Change the Caption property of Command1 to "Push Me" (as an example).</li>  In the Click event of the command button, type this command: WAIT WINDOW "I'm here!" </li> Select Column1 from the Object DropDown. Highlight the CurrentControl property under the All tab. Select Command1 from the DropDown, or double-click the property name.</li> Add a table to the Data Environment. You may do this by choosing Data Environment from the View menu. Then click the right-mouse button and select Add Table. Now select a table from a currently open database, or select a Free Table. Once you have added a table, close the Data Environment window.</li> Select Column2 from the Object DropDown in the Properties sheet.</li> Set the ControlSource to one of the fields in the table you added to the Data Environment.</li> Save the form, and run it.</li></ol>

Additional query words: VfoxWin

Keywords: KB127843

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.