ComponentOne True DBGrid Pro 8
BookmarkType Property (TDBDropDown)

The BookmarkType property returns or sets the variant type of bookmarks returned by a TDBGrid or TDBDropDown control through its properties, methods, and events.

Syntax

object.BookmarkType= integer

Remarks

Read/Write at run time. Not available at design time.

Use this property to ensure that the control conforms to the bookmark type expected by a bound data source, including ADODC and RDC controls. This property is used only in bound mode and has no effect in unbound or storage modes.

In some cases, the bookmarks returned by the grid are incompatible with the ADO Recordset object exposed by an OLE DB data source, even though the grid uses the same bookmarks internally to retrieve and modify data. For example, code such as the following may generate a type mismatch error:

ADODC1.Recordset.Bookmark = TDBGrid1.RowBookmark(0)

You can use the BookmarkType property in conjunction with the DataSourceChanged event to circumvent type mismatch errors that may occur when a grid-supplied bookmark is passed to an ADO Recordset object (or vice versa). The workaround is as follows:

Sub TDBGrid1_DataSourceChanged()

    TDBGrid1.BookmarkType = VarType(ADODC1.Recordset.Bookmark)

End Sub

This code ensures that any bookmarks returned by the grid are first converted to the appropriate type for the bound data source. This workaround is only needed when using the grid in an HTML page; it is not needed for Visual Basic 6.0.

Note

The same technique can be used when the grid is bound to a Remote Data Control (RDC). Prior to version 5.0c, a bookmark returned by the grid had to be converted to a long integer before it could be passed to an rdoResultset (RDO) object.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback