Hi TJM,
You can handle the CurrentCellKeyUp event to detect the EnterKey for moving current cell to next enabled cell in a grid. And you can detect LastColIndex from the CurrentCellKeyDown event. Here is a code snippet.
int LastColIndex = -1;
void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.Enter)
{
GridControl grid = sender as GridControl;
GridCurrentCell cc = grid.CurrentCell;
LastColIndex = cc.ColIndex;
}
}
void gridControl1_CurrentCellKeyUp(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.Enter)
{
GridControl grid = sender as GridControl;
GridCurrentCell cc = grid.CurrentCell;
if( LastColIndex == cc.ColIndex )
{
int row = cc.RowIndex, col = cc.ColIndex + 1;
if (!grid.Model[row, col].Enabled)
{
for (int i = row; i <= grid.RowCount; i++)
{
row = i;
cc.QueryNextEnabledCell(GridDirectionType.Right, ref row, ref col);
if (grid.Model[row, col].Enabled)
break;
col = 1;
}
cc.MoveTo(row, col);
cc.ScrollInView();
}
}
}
}
Here is a modified sample for implementation and let me know if this helps.
ModifiedWindowsApplication2.zipBest regards,
Haneef