ADAdministrator Syncfusion Team July 1, 2003 11:50 PM
You can use code like
Dim cc As GridCurrentCell = Me.grid.CurrentCell
cc.MoveTo(1, 2, GridSetCurrentCellOptions.SetFocus)
If you are doing this when the grid is hidden (like in Form_Load or from another tab that is active), you should also set:
Me.grid.ForceCurrentCellMoveTo = True
JCjacky chenJuly 2, 2003 09:12 PM
but it doesn't really work,
what i really want is when user clicks on a cell, it activates not the currently clicked cell but another one that i specify in my code.
i tried the line you gave, the cursor disappeared from the currently clicked cell but it doesn't go to the one specified in MoveTo method, and typing on keyboard doesn't produce anything on either cell.
could you kindly explain to me what's exactly happening? thanks
ADAdministrator Syncfusion Team July 3, 2003 02:36 AM
You cannot call a CurrentCell.MoveTo if the grid is in the process of deactivating or activating a cell. (Sort of like calling a MoveTo from within a MoveTo - the grid does not know how to handle this.)
I suspect this is what is going on at the point you called MoveTo. The grid was already in the process.
If you want to do someting like this, you can handle MouseDown, remember the cell. And then handle MouseUp, checking to see if it is the same MouseDown cell, and if it is a cell you do not want to click. If it is, then call MoveTo at that point.
private int mouseDownRow = -1;
private int mouseDownCol = -1;
private void gridControl1_GridControlMouseDown(object sender, Syncfusion.Windows.Forms.CancelMouseEventArgs e)
this.gridControl1.PointToRowCol(new Point(e.MouseEventArgs.X, e.MouseEventArgs.Y), out mouseDownRow, out mouseDownCol, -1);
private void gridControl1_GridControlMouseUp(object sender, Syncfusion.Windows.Forms.CancelMouseEventArgs e)
if( this.gridControl1.PointToRowCol(new Point(e.MouseEventArgs.X, e.MouseEventArgs.Y), out row, out col, -1)
&& row == mouseDownRow && col == mouseDownCol)
//change the click from cell 2,2 to 1,1
if(row == 2 && col == 2)
// and/or maybe
mouseDownRow = -1;
mouseDownCol = -1;