Imports Infragistics.Win.UltraWinGrid
Sometimes you may want to force focus into a cell and put that cell into edit mode to indicate to a user that a value needs to be changed. This can be accomplished by setting the ActiveCell property of the grid, and then calling PerformAction to put the cell into Edit mode.
Before you start writing any code, you should place using/imports directives in your code-behind so you don’t need to always type out a member’s fully qualified name.
In Visual Basic:
Imports Infragistics.Win.UltraWinGrid
In C#:
using Infragistics.Win.UltraWinGrid;
You need a reference to the cell you want to set focus to. In this case, assume the cell is in the active row and is in a column called "CompanyName" You get a reference to the cell by using the Cells collection of the ActiveRow object.
In Visual Basic:
Dim aCell As UltraGridCell aCell = Me.UltraGrid1.ActiveRow.Cells("CompanyName")
In C#:
UltraGridCell aCell = this.ultraGrid1.ActiveRow.Cells["CompanyName"];
Now that you have a reference to the cell, you can make it active by setting the ActiveCell of the grid.
In Visual Basic:
Me.UltraGrid1.ActiveCell = aCell
In C#:
this.ultraGrid1.ActiveCell = aCell;
At this point, you may need to set focus to the grid. This is only necessary if the grid does not already have focus.
In Visual Basic:
Me.UltraGrid1.Focus()
In C#:
this.ultraGrid1.Focus();
You can force the cell into edit mode by calling the PerformAction method.
In Visual Basic:
Me.UltraGrid1.PerformAction(UltraGridAction.EnterEditMode, False, False)
In C#:
this.ultraGrid1.PerformAction(UltraGridAction.EnterEditMode, false, false);