GetGridCurrentRow method (WinStudio scripts)

Applies To

IWSFormComponents interface, unbound grid components and grid components bound to secondary collections

Definition

Returns the index number of the current row of an unbound grid component or a grid component bound to a secondary collection.

Syntax

object.GetGridCurrentRow( )

  Part   Description
object Required. A reference to a valid grid component.

Remarks

The return value is an integer representing the index number for the current row in the grid component. The index number is zero-based. Row 0 is the row of column titles at the top of the grid. Row 1 is the first data row.

If the DeleteGridRows method deletes the current row, the GetGridCurrentRow method returns the index for the row that was deleted.

Example

Sub Main()
   Dim oGrid As IWSFormComponent
   Dim iCurrentRow As Integer
   Dim iCurrentColumn As Integer
   Dim iRowCount As Integer
   oGrid = ThisForm.Components("grid1")
   iCurrentRow = oGrid.GetGridCurrentRow()
   iCurrentColumn = ThisForm.Components("grid1").GetGridCurrentCol()
   iRowCount = ThisForm.Components("grid1").GetGridRowCount()
   'Display row, column, and row count numbers in a message box.
   Application.ShowMessage("Row = " & iCurrentRow.ToString() & vbLf & _
      "Column = " & iCurrentColumn.ToString() & vbLf & _
      "Number of rows = " & iRowCount.ToString())
End Sub