MultiRow Windows Forms > Developer's Guide > Using MultiRow > Rows and Cells > Current Cell |
The cell in which the user is working is called the current cell. You can write code independent of the cell index if you reference the cells through the current cell. You can access the current cell using the GcMultiRow.CurrentCell property.
Retrieve the current cell index using the GcMultiRow.CurrentCellPosition.CellIndex property.
This example gets the current cell index.
Console.WriteLine("Current cell index: {0}", GcMultiRow1.CurrentCellPosition.CellIndex) |
Console.WriteLine("Current cell index: {0}", gcMultiRow1.CurrentCellPosition.CellIndex); |
To move the current cell, set a new cell position in the GcMultiRow.CurrentCellPosition property.
This example moves the current cell.
GcMultiRow1.CurrentCellPosition = New GrapeCity.Win.MultiRow.CellPosition(0, 1) |
gcMultiRow1.CurrentCellPosition = new GrapeCity.Win.MultiRow.CellPosition(0, 1); |
You can use the GcMultiRow.CurrentCell property to access the current cell. The following code shows how to change the backcolor of the current cell.
This example sets the backcolor for the current cell.
GcMultiRow1.CurrentCell.Style.BackColor = Color.Azure |
gcMultiRow1.CurrentCell.Style.BackColor = Color.Azure; |
The GcMultiRow.CurrentCell property returns null (Nothing in Visual Basic) if the current cell does not exist, for example, when the template is not set in the GcMultiRow control or when the GcMultiRow control is in Display mode.