Back to Devexpress

VGridControl.LocateByValue(String, Object) Method

windowsforms-devexpress-dot-xtraverticalgrid-dot-vgridcontrol-dot-locatebyvalue-x28-system-dot-string-system-dot-object-x29.md

latest2.7 KB
Original Source

VGridControl.LocateByValue(String, Object) Method

Returns the handle of the record that contains the specified value in the specified field.

Namespace : DevExpress.XtraVerticalGrid

Assembly : DevExpress.XtraVerticalGrid.v25.2.dll

NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid

Declaration

csharp
public int LocateByValue(
    string fieldName,
    object val
)
vb
Public Function LocateByValue(
    fieldName As String,
    val As Object
) As Integer

Parameters

NameTypeDescription
fieldNameString

A string that specifies the name of the field in which to search for the specified value.

| | val | Object |

An object that specifies the value to find.

|

Returns

TypeDescription
Int32

An integer value that specifies the handle of the record that contains the specified value in the specified field. The DevExpress.Data.DataController.InvalidRow field value is returned, if no record is found that matches the specified conditions.

|

Remarks

The code below focuses the record that contains “Rolls-Royce“ in the “Trademark“ field.

csharp
vGridControl1.FocusedRecord = vGridControl1.LocateByValue("Trademark", "Rolls-Royce");
vb
vGridControl1.FocusedRecord = vGridControl1.LocateByValue("Trademark", "Rolls-Royce")

See Also

LocateByDisplayText(Int32, EditorRow, String)

GetRowByFieldName(String)

GetCellValue

VGridControl Class

VGridControl Members

DevExpress.XtraVerticalGrid Namespace