Microsoft KB Archive/128205

= How to Set Buffering Mode in Visual FoxPro =

Article ID: 128205

Article Last Modified on 11/17/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual FoxPro 3.0b for Macintosh

-



This article was previously published under Q128205



SUMMARY
Data buffering is used in Visual FoxPro to enable edits to be made and verified in memory before they are applied to a .DBF file and to handle some record contention issues in a multiuser environment. There are several ways to use buffering within Visual FoxPro. This article gives you an overview.



MORE INFORMATION
There are two ways to set the buffereing mode. Issue a SET MULTILOCKS ON, or choose the Multiple Record Locks check box in the Data Tab of the Tools, Options dialog to begin buffering data. Use one of the following methods to set the buffering mode.

Setting the Buffering Mode Through the Visual FoxPro Interface
Use any one of the following methods to set the buffering mode through the Visual FoxPro user interface:


 * To set the buffering mode for an open table, you can use the Properties button in the View Window. This method sets the buffering properties for the currently selected table only.

-or-
 * To set the buffering mode for subsequently opened tables, you can use the Buffering list box in the Data tab of the Tools, Options dialog.

-or-
 * In the form designer, you can set the form.BufferMode property to 1 for Pessimistic Buffering, or to 2 for Optimistic Buffering. If BufferMode is set to 1 or 2, table buffering is enabled for any cursor used by a grid control. Any other control bound to data uses row buffering. This property sets the default buffering mode for all tables used in the form.

-or-
 * In the form designer, you can set the default buffering mode for individual cursors in the Data Environment by setting the BufferModeOverride property. The default for this property is 1 (Use the default buffering mode of the form).

NOTE: You cannot set a default buffering mode for a table through the Database Designer.

Setting the Buffering Mode Programatically
To set the buffering mode programatically, you can use the CURSORSETPROP function to enable or disable buffering on an open table. The following line of code sets Optimistic Row buffering: SET MULTILOCKS ON  =CURSORSETPROP("Buffering",3) You must issue this line of code for each open table on which you wish to enable buffering. This command overrides the default BufferMode property on a form, or the default BufferModeOverride property for a cursor in the Data Environment for the Form.

