>************************************************** >*-- Class: txtgrdnextrow >*-- ParentClass: textbox >*-- Moves to same column in next row when tab or enter is pressed > >Define Class txtgrdnextrow As txtgrid > BorderStyle = 0 > Height = 18 > Margin = 0 > SelectOnEntry = .F. > SpecialEffect = 1 > Width = 100 > Name = "xtxtgrdnextrow" > > *-- Move to the same column in the next row of the grid > Procedure move2nextrow > Local lnMaxRows > With This.Parent.Parent > *** Calculate the maximum number of rows in the grid > lnMaxRows = Int( ( .Height - .HeaderHeight - Iif( Inlist( .ScrollBars, 1, 3 ), Sysmetric( 8 ), 0 ) ) / .RowHeight ) > *** If we are sitting on the bottom row in the visible portion of the grid, > *** Scroll the grid down a row in case there is a next record > If .RelativeRow >= lnMaxRows > .DoScroll( 1 ) > Endif > .ActivateCell( .RelativeRow + 1, .ActiveColumn ) > Endwith > Endproc > > Procedure KeyPress > Lparameters nKeyCode, nShiftAltCtrl > If nKeyCode = 13 Or nKeyCode = 9 && Enter or Tab > This.move2nextrow() > Nodefault > Endif > Endproc >Enddefine >Thanks. Let me test it.