Returns an object from the collection using a unique key value. The key must be unique within the collection. If the collection's IDatabaseObjects.Subset has been implemented then the key need only be unique within the subset specified, not the entire database table.

Namespace: DatabaseObjects
Assembly: DatabaseObjects (in DatabaseObjects.dll) Version: 3.8.1.0

Syntax

C#
public IDatabaseObject ObjectByKey(
	IDatabaseObjects objCollection,
	Object objKey
)
Visual Basic
Public Function ObjectByKey ( _
	objCollection As IDatabaseObjects, _
	objKey As Object _
) As IDatabaseObject
Visual C++
public:
IDatabaseObject^ ObjectByKey(
	IDatabaseObjects^ objCollection, 
	Object^ objKey
)

Parameters

objCollection
Type: DatabaseObjects..::..IDatabaseObjects
The collection which contains the object.
objKey
Type: System..::..Object
The key that identifies the object with the collection. The key is the value of the field defined by the collection's IDatabaseObjects.KeyFieldName.

Return Value

IDatabaseObject (DatabaseObjects.IDatabaseObject)

Examples

CopyC#
Default Public ReadOnly Property Item(ByVal strProductCode As String) As Product
    Get

        Return objDatabase.ObjectByKey(Me, strProductCode)

    End Get
End Property

See Also