Microsoft KB Archive/138649

= How to Use OLE to Edit General Fields in Visual FoxPro =

Article ID: 138649

Article Last Modified on 8/26/1999

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition

-



This article was previously published under Q138649



SUMMARY
Editing general fields is much easier in Visual FoxPro. A new control called the OLE Bound Control is used to select general fields in the Form Builder and allow editing of a general field when the form is running. The application used to place the data into the general field when it was created is the application that will appear on the screen when the form is running and you click the general field to edit it.

For example, if you placed data into the general field by clicking Insert Object on the Edit menu and then clicking Paintbrush, Paintbrush will appear when you click the general field object of the form. Some applications that are OLE 2.0 aware, such as Microsoft Word or Microsoft Excel, will add their functionality to the FoxPro menu, so you need only click the menu to change the data in the general field object of the form.



Step-by-Step Example
 Create a table with a general field in it, and save the table. When prompted to Input Data Records Now, click Yes. Double-click the general field to open it. On the Edit menu, click Insert Object. In the Object Type list, scroll down to the Paintbrush Picture item and select it. When Paintbrush appears, draw something in the paintbrush window. On the File menu in Paintbrush, click Exit to Return to . Click Yes in the window that appears to update the general field. Close the general field by pressing CTRL+W. Add another record to the table and repeat step 2. This time select another application in the Object Type box. If the application is OLE 2 aware, editing will take place in the general field itself. Close the general field to save the data placed into it. Close the Browse window of the table, and create a form. Choose the OLE Bound Control from the Forms Control toolbar, and place it on the form. In the Properties sheet, type the name of the general field in the ControlSource property of the OLE Bound control. To allow all of the data from the general field to fit into the OLE object of the form, select 1 or 2 in the Stretch property.</li>  Place a command button on the form, and type the following code into its Click event: SKIP THISFORM.REFRESH </li> Run the form, and double-click the general field. Note that Paintbrush appears allowing the picture to be edited. Make changes to the paintbrush picture, and close it. Click the command button, and then double-click the general field again. Note that the application used to place the data into the general field earlier appears again.</li></ol>

Additional query words: VFoxWin

Keywords: KB138649

-

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

© Microsoft Corporation. All rights reserved.