DataMode Property

Returns or sets the type of data binding used by the control when it is connected to a data source (read-only or read/write).

Syntax

[form!]VSFlexGrid.DataMode[ = DataModeSettings ]

Remarks

The settings for the DataMode property are described below:

 

Constant

Value

Description

flexDMFree

0

This setting causes the data to be read from the database when the program starts, when the data source is refreshed, and when the user calls the DataRefresh method. Any direct changes to the database (edits and cursor movements) are ignored by the control. The flexDMFree setting is equivalent to the data binding implemented in the MSFlexGrid control.

flexDMBound

1

This setting causes the data in the database to be permanently synchronized with the control. The current row is linked to the database cursor, so when the Row property changes, the database cursor moves and vice-versa. All edits to the control contents are updated in the database and vice-versa. The flexDMBound setting is similar to the data binding implemented in the Microsoft DBGrid control.

flexDMBoundBatch

2

Similar to the flexDMBound setting, except the source recordset is not updated automatically after the user edits a cell.

flexDMBoundImmediate

3

Similar to the flexDMBound setting, except the source recordset is updated automatically after the user edits a cell.

flexDMBoundNoRowCount

4

Please provide description.

 

The flexDMBound mode handles updates to the recordset automatically, based on the setting of the recordset's LockType property. The flexDMBoundBatch and flexDMBoundImmediate allow you to bypass the recordset's LockType setting. This is usually a bad idea, and these settings should not be used unless you have a good reason to do so.

When the DataMode property is set to a value other than flexDMFree, some properties and methods are disabled or their behavior is restricted:

 

Property

Limitation when Data-Bound

AddItem

The second parameter of the AddItem method, the position where the new row should be inserted, is ignored. New rows are always appended to the database.

Rows, Cols

These properties become read-only. You may add or remove records from the database one at a time using the AddItem and RemoveItem methods.

FixedRows, FixedCols

These properties become read-only at run time. You need to decide how many fixed rows and columns you want at design time.

Sort, RowPosition

These properties are disabled. You may sort the database records by modifying the SQL statement in the data source or using the Sort method on the source recordset.

IsSubtotal

This property becomes read-only. You may add or clear subtotals using the Subtotal method.

 

Data Type

DataModeSettings (Enumeration)

See Also

VSFlexGrid Control