GrapeCity MultiRow Windows Forms Documentation
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.

Retrieving the Current Cell Index

Retrieve the current cell index using the GcMultiRow.CurrentCellPosition.CellIndex property.

Using Code

This example gets the current cell index.

[VB]

Console.WriteLine("Current cell index: {0}", GcMultiRow1.CurrentCellPosition.CellIndex)

[CS]

Console.WriteLine("Current cell index: {0}", gcMultiRow1.CurrentCellPosition.CellIndex);

Moving the Current Cell

To move the current cell, set a new cell position in the GcMultiRow.CurrentCellPosition property.

Using Code

This example moves the current cell.

[VB]

GcMultiRow1.CurrentCellPosition = New GrapeCity.Win.MultiRow.CellPosition(0, 1)

[CS]

gcMultiRow1.CurrentCellPosition = new GrapeCity.Win.MultiRow.CellPosition(0, 1);

Accessing the Current Cell

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.

Using Code

This example sets the backcolor for the current cell.

[VB]

GcMultiRow1.CurrentCell.Style.BackColor = Color.Azure

[CS]

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.

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options