请问VFP中下面这个程序该怎么翻译呢?s=""f=.T.*** FOUND ***FOR i=1 TO thisform.List1.Count IF thisform.List1.Selected(i) IF f*** FOUND *** s=thisform.List1.list(i) f=.F. ELSE*** FOUND *** s=s+thisform.List1.list(i) ENDIF ENDIFENDFORst="select &s from orders into cursor tmp"thisform.Grid1.RecordSource=st
问题描述:
请问VFP中下面这个程序该怎么翻译呢?
s=""
f=.T.
*** FOUND ***
FOR i=1 TO thisform.List1.Count
IF thisform.List1.Selected(i)
IF f
*** FOUND ***
s=thisform.List1.list(i)
f=.F.
ELSE
*** FOUND ***
s=s+thisform.List1.list(i)
ENDIF
ENDIF
ENDFOR
st="select &s from orders into cursor tmp"
thisform.Grid1.RecordSource=st
答
设置变量s为空字符串,f为逻辑真,从头到尾搜索列表框(列表框中存放表orders的字段名),若第一次搜索到某一列表项被选中,将其值存入s,若以后再搜索到某一列表项被选中,则将其值追加到s后面,全部搜索完毕,将表orders的用列表框指定的字段内容作为虚拟表tmp, 将虚拟表中的内容在表格grid1中显示出来.