In the Creating Forms chapters that come later in this User’s Guide, you can follow the instructions for views when you create a form for CursorAdapters. In VPME creating a form that uses CursorAdapters is basically the same as creating forms that use views, except for the following:
· NoData CursorAdapter Property Instead of NoDataOnLoad Property: When you use a filtered CursorAdapter with a form, you must set the CursorAdapter's NoData property to .T. to prevent Visual FoxPro from displaying prompts when a form loads.
· Adding CursorAdapter to Data Environment: The steps involved in adding a CursorAdapter to a form’s Data Environment are different.
Ø To add a CursorAdapter to a form’s Data Environment
1. In the Form Designer open the Data Environment of the form.
2. Right-click on the Data Environment window.
3. Select the Builder option on the right-click menu. Note: If you select the Add CursorAdapter option on the right-click menu, an empty CursorAdapter will be added to the Data Environment that is based on the default VFP CursorAdapter class, which is not what you want.
4. In the DataEnvironment Builder form activate the Cursors page.
5. Click the Add button.
6. In the Open dialog find the class library that contains the CursorAdapter class that you want to add to the Data Environment. Then, select the desired CursorAdapter class and click the OK button.
7. Important: In the CursorAdapter Builder form that comes up, click the Cancel button.
Tip – Be Sure to Click Cancel: See the next section, “Avoiding a VFP CursorAdapter Builder Error”, to learn why it is important that you click the Cancel Button on the CursorAdapter Builder form.
8. The selected CA will then appear in the list of CAs in the DataEnvironment Builder form. Click the OK button and the CA will be added to the DE.