When I replaced the Apex dbGrid, with the free upgrade, TDBGridS1.OCX,I got complaints about the behavior of the grids when I enteredor edited data in TDBGrid Standard. The cell pointer stays putand highlights the text just entered. The user must press theenter key a second time or use the arrow key to move to the nextcell.
Three lines of code automatically move the cursor to the nextcell after entering or editing a cell. The grid is in the Boundmode.
1. Create a form level variable:
Dim KC as integer
2. In the TDBGridS1_Keydown Event:
Private Sub TDBGridS1_KeyDown(KeyCode _ As Integer, Shift As Integer) KC = KeyCode ' Trap the keycodeEnd Sub
3. In the TDBGridS1_AfterColEdit Event:
Private Sub _ TDBGridS1_AfterColEdit(ByVal _ ColIndex As Integer) ' statments go here ' on the last line use this code: If KC = 13 Then SendKeys "{Enter}"End Sub