Syncfusion.Grid.Windows


Syncfusion.Windows.Forms.Grid Namespace > GridCurrentCell Class > MoveTo Method : MoveTo(Int32,Int32,GridSetCurrentCellOptions,Boolean) Method
The row index.
The column index.
A GridSetCurrentCellOptions value that details options how to activate the current cell. You can specify if the associated control should get focus, if range selection should be ignored and more.
True if changes can be discarded; False otherwise.

MoveTo(Int32,Int32,GridSetCurrentCellOptions,Boolean) Method

Moves the current cell to the specified position and gives instruction about activation of the current cell. Changes may be discarded in the previous current cell.
Syntax
'Declaration
 
Public Overloads Function MoveTo( _
   ByVal rowIndex As Integer, _
   ByVal colIndex As Integer, _
   ByVal options As GridSetCurrentCellOptions, _
   ByVal discardChanges As Boolean _
) As Boolean
'Usage
 
Dim instance As GridCurrentCell
Dim rowIndex As Integer
Dim colIndex As Integer
Dim options As GridSetCurrentCellOptions
Dim discardChanges As Boolean
Dim value As Boolean
 
value = instance.MoveTo(rowIndex, colIndex, options, discardChanges)

Parameters

rowIndex
The row index.
colIndex
The column index.
options
A GridSetCurrentCellOptions value that details options how to activate the current cell. You can specify if the associated control should get focus, if range selection should be ignored and more.
discardChanges
True if changes can be discarded; False otherwise.

Return Value

True if the current cell could be moved; False otherwise.
Remarks
Moving the current cell is a two step process. In the first step, the grid deactivates the existing current cell, in the second step the grid activates the new current cell.

All parameters that were specified in this method call will be saved. This allows event handler to have better background knowledge why certain events were raised.

You can determine if Deactivate was called stand-alone or as result of a MoveTo(Int32,Int32,GridSetCurrentCellOptions,Boolean) call by checking the IsInMoveTo property.

You can find out about the current cell's position by querying the RowIndex and ColIndex properties of the CurrentCell object in GridControlBase.

After saving parameter information MoveTo(Int32,Int32,GridSetCurrentCellOptions,Boolean) raises a cancelable CurrentCellMoving event. If the event handler set the System.ComponentModel.CancelEventArgs.Cancel flag of the GridCurrentCellMovingEventArgs object, the method will return immediately. CurrentCellMoving gives you the chance to modify the parameters of the MoveTo(Int32,Int32,GridSetCurrentCellOptions,Boolean) function call. You can modify the row and column index and the options.

The next step is to deactivate the current cell. See Deactivate for a detailed overview what events will get raised from Deactivate.

After the cell has been deactivated, the current cell will be activated at the new position. See the Activate(Int32,Int32) method for information which events are raised. If the GridSetCurrentCellOptions.NoActivate option is specified no current cell will be activated.

You can sandwich the deactivation and activation process with a BeginUpdate, EndUpdate call pair if you specify the GridSetCurrentCellOptions.BeginEndUpdate option.

At last, a CurrentCellMoved event is raised which completes this operation.

If an exception occurred or if an event handler requested to cancel the operation, MoveTo(Int32,Int32,GridSetCurrentCellOptions,Boolean) will instead close up the operation with a CurrentCellMoveFailed event.

This ensures that you will be guaranteed either a CurrentCellMoved or CurrentCellMoveFailed event after a CurrentCellMoving event.

AssemblyVersion

Syncfusion.Grid.Windows: 17.3460.0.14

See Also