SetFieldFocus

This method sets the focus to the specified field or table cell and updates the HighlightField, HighlightColumnIndex, and HighlightRowIndex settings.

The method returns an error message if the specified field or table cell is hidden or does not exists on the verification form.

Do not use this method in either VerifierFormLoad or in any Validate field or table events. These events often execute in sequence and may affect the focus following each event, independent of SetFieldFocus.

Carefully use this method within the FocusChanged or CellFocusChanged events, as an endless loop may result.

Syntax

SetFieldFocus(BSTR FormName, ISCBCdrWorkdoc pWorkdoc, BSTR bstrFieldName, BSTR bstrTableColumnName, long lTableRowIndex)
Parameter Description
FormName Verification form name
pWorkdoc The current workdoc
bstrFieldName Field name
bstrTableColumnName Column name
lTableRowIndex Row index
Note: The SetFieldFocus action is cancelled when the RowIndex value is "-1".

Sample Code

The following sample code sets the focus to the field "Table" in the first row of the column "Quantity".

Private Sub Document_OnAction(pWorkdoc as SCBCdrPROJLib.ISCBCdrWorkdoc, ByVal ActionName as String)
   If ActionName = "GoToField" Then
      Project.SetFieldFocus("Form_Invoices_1", pWorkdoc, "Table", "Quantity", 0)
   End If
End Sub