I have a wingrid which is set to allow me to edit the data in the cells. When I tab through my form and reach my grid I want to enter the grid (adding an initial row if there are none already) and go into edit mode on the first cell of the grid. So far I have managed the majority of this, however I am having trouble getting the cell to go straight into edit mode. When I tab into the grid the first row is selected (or added) and the first cell is selected/activated, however I cannot seem to get the cell to go straight to edit mode (giving me the cursor) without me actually clicking the cell with the mouse.
Below is the code I am using for entering the grid. the code is actually located in a custom class which inherits the grid and adds some default functionality as required in my application.
.GotFocus
EnterEditGrid()
Sub
Then
StNewRow()
.DataSource.Tables(0).newrow)
.DataSource.newrow)
Else
If
.Rows(0).Cells(intFirstCol).Activate()
.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode)
True
I have a couple of suggestions...
First, I would not use the GotFocus event. You should use Enter instead. Even Microsoft's documentation will advise you against using GotFocus since it's tied directly to the Windows messages and doesn't usually work well in DotNet programming.
Second, this is probably just a timing problem. Instead of calling PerformAction(EnterEditMode) inside the event handler, use a BeginInvoke so that the grid completes whatever it is currently doing before the method gets called.