MultiRow Windows Forms > Developer's Guide > Using MultiRow > Rows and Cells > Current Row |
The row in which the user is working is called the current row. You can write code independent of the row index if you reference the rows through the current row. You can access the current row by using the GcMultiRow.CurrentRow property.
You can retrieve the current row index using the GcMultiRow.CurrentCellPosition.RowIndex property.
This example gets the current row index.
Console.WriteLine("Current row index: {0}", GcMultiRow1.CurrentCellPosition.RowIndex) |
Console.WriteLine("Current row index: {0}", gcMultiRow1.CurrentCellPosition.RowIndex); |
To move the current row, set a new row position in the GcMultiRow.CurrentCellPosition property.
This example moves the current row.
GcMultiRow1.CurrentCellPosition = New GrapeCity.Win.MultiRow.CellPosition(1, 0) |
gcMultiRow1.CurrentCellPosition = new GrapeCity.Win.MultiRow.CellPosition(1, 0); |
You can access the cells in the current row using the Row.Cells property.
This example gets the current cell index.
Imports GrapeCity.Win.MultiRow For Each cell As Cell In GcMultiRow1.CurrentRow.Cells Console.WriteLine("Cell index: {0}", cell.CellIndex) Next |
using GrapeCity.Win.MultiRow; foreach (Cell cell in gcMultiRow1.CurrentRow.Cells) { Console.WriteLine("Cell index: {0}", cell.CellIndex); } |
If the current row does not exist, the GcMultiRow.CurrentRow property returns a null reference (Nothing in Visual Basic). For example, when the template is not set in the GcMultiRow control or when the GcMultiRow control is in Display mode (GcMultiRow.ViewMode=Display).
For information about displaying the indicator in the current row, see Using Row Headers.
Use the GcMultiRow.CurrentRowBorderLine property to set the border style for the current row.
This example sets the CurrentRowBorderLine property.
GcMultiRow1.CurrentRowBorderLine = New GrapeCity.Win.MultiRow.Line(GrapeCity.Win.MultiRow.LineStyle.Medium, Color.Red) |
gcMultiRow1.CurrentRowBorderLine = new GrapeCity.Win.MultiRow.Line(GrapeCity.Win.MultiRow.LineStyle.Medium, Color.Red); |