I am using WinGrid 2010.1 and when I would like to select a cell on the first row, highlight it and allow the user to modify the cell without clicking again. This is what I have to select the current cell:
dgDataEntry.Rows(0).Cells(7).Selected =
True
dgDataEntry.Focus()
The above highlights the cell that I want and the cell turns blue. The user has to click in the cell to be able to modify the data. Question is:
How can the user just type into the cell without clicking first?
You can't have a cell in the grid be in edit mode and be selected. That is - the cell cannot be selected, but you can select the Text in the cell. It sounds like that's what you want.
What you should do is set the Focus to the grid (if it doesn't already have focus), then set the ActiveCell in the grid, then call PerformAction(EnterEditMode).
Me.ultraGrid1.Focus() Me.ultraGrid1.Rows(0).Cells(7).Activate() Me.ultraGrid1.PerformAction(UltraGridAction.EnterEditMode)
Also... I recommend using the key of the column, rather than the index when you get the cell. An index can change. For example, the index will change when the user rearranges the columns in the grid, which is allowed by default.
grid.DisplayLayout.Override.CellClickAction = CellClickAction.EditAndSelectText;