在表单中控件里取得动态序号
在查询表单GRID控件中如何在左边得到一个记录号,有N条记录就有序号1到N,一目了然查到了N条记录.
程序代码:
sele recn() xh,* from 表 into curs a1 thisform.grid1.RecordSource="a1" thisform.grid1.RecordSourcetype=1
*VFP9代码 *GRID1.INIT事件代码 CREATE CURSOR T (名称 C(30),分类 C(10)) FOR I=1 TO 4 FOR J=1 TO ALANGUAGE(AB,I) INSERT INTO T VALUES (IIF(I!=2,AB(J),AB(J,1)+'('+')'),ICASE(I=1,[命令],I=2,[函数],I=3,[基本类],[DBC事件])) ENDFOR ENDFOR GO TOP WITH THISFORM.GRID1 .COLUMNCOUNT=FCOUNT([T]) .RECORDSOURCE=[T] FOR I=1 TO .COLUMNCOUNT .COLUMNS(I).HEADER1.CAPTION=FIELD(I,[T]) .COLUMNS(I).HEADER1.ALIGNMENT=2 ENDFOR .ADDCOLUMN(1) WITH .COLUMNS(.COLUMNCOUNT) .CONTROLSOURCE="PADL(RECNO([T]),LEN(TRANSFORM(RECCOUNT([T]))),[0])" .NAME = "NEWCOLUMN" .HEADER1.CAPTION=[序号] .HEADER1.ALIGNMENT=2 ENDWITH .AUTOFIT ENDWITH