** test.prg
CREATE CURSOR tt (f1 I, f2 I, f3 I)
FOR i=1 TO 100
INSERT INTO tt VALUES (i, i*2, i*3)
ENDFOR
of = CREATEOBJECT("form1")
of.show(1)
DEFINE CLASS form1 as Form
ADD OBJECT cmd1 as commandbutton WITH top=10,left=10,height=22
ADD OBJECT cmd2 as commandbutton WITH top=10,left=130,height=22
ADD OBJECT grid1 as grid WITH top=40,left=10,recordsourcetype=4,;
recordsource="SELECT * FROM tt INTO CURSOR tt_tmp"
PROCEDURE cmd1.click
thisform.grid1.recordsource="SELECT f1,f3 FROM tt INTO CURSOR tt_tmp"
ENDPROC
PROCEDURE cmd2.click
thisform.grid1.recordsource="SELECT f2,f1 FROM tt INTO CURSOR tt_tmp"
ENDPROC
ENDDEFINE