oForm=createobject('form1') oForm.Show Read events Define CLASS form1 AS form DataSession = 2 Top = 0 Left = 0 Height = 215 Width = 457 DoCreate = .T. Caption = "Form1" Name = "Form1" Add OBJECT command1 AS commandbutton WITH ; Top = 36, ; Left = 360, ; Height = 27, ; Width = 84, ; Caption = "Down", ; Name = "Command1" Add OBJECT command2 AS commandbutton WITH ; Top = 72, ; Left = 360, ; Height = 27, ; Width = 84, ; Caption = "Up", ; Name = "Command2" Procedure Init This.Addobject('grdemployee','grid') With this.grdEmployee .RecordSource = "crsTest" .Visible = .t. Endwith Endproc Procedure Load Select *, 0x7FFFFFFF as sorter from employee order by last_name into cursor crs1 nofilter Use dbf('crs1') in 0 again alias 'crsTest' Use in 'crs1' Use in 'employee' Select crsTest Replace all sorter with recno() Index on sorter tag sorter Endproc Procedure QueryUnload Clear events Endproc Procedure command1.Click If sorter=reccount() Return Endif With ThisForm.grdEmployee lnRec = recno(.recordsource) Skip in (.recordsource) Replace sorter with sorter-1 in .RecordSource Go lnRec Replace sorter with sorter+1 in .RecordSource lnSorter = eval(.RecordSource+'.sorter') Thisform.lockscreen = .t. Locate .refresh =seek(lnSorter, .RecordSource, 'sorter') .Refresh Thisform.lockscreen = .f. Endwith Endproc Procedure command2.Click If sorter<=1 Return Endif With ThisForm.grdEmployee lnRec = recno(.recordsource) Skip - 1 in (.recordsource) Replace sorter with sorter+1 in .RecordSource Go lnRec Replace sorter with sorter-1 in .RecordSource .Refresh Endwith Endproc EnddefineCetin