当前位置:网站首页>Thirty lines of code prevent VFP forms from running repeatedly, and the function supports parameter transfer

Thirty lines of code prevent VFP forms from running repeatedly, and the function supports parameter transfer

2022-06-25 11:43:00 VFP of Garfield

VFP most 26 Parameters , You can't stop writing

Procedure runform
Parameters cformname,mformname,Parameter1,Parameter2,Parameter3,Parameter4,Parameter5,Parameter6,Parameter7,Parameter8,Parameter9,Parameter10

For nCount=10 To 1 STEP -1
cName=“Parameter”+Alltrim(Str(nCount))
IF VARTYPE(&cName)“L” AND &cName.f.
else
EXIT
ENDIF
ENDFOR

*– Create a parameter
LOCAL strPara
strPara=""
FOR nPcount=1 TO nCount
cName=“Parameter”+Alltrim(Str(nPcount))
strPara =strPara +","+ cName
ENDFOR
strPara= RIGHT(strPara,LEN(strPara)-1)

cpublic = “Public “+mformname
&cpublic
If !(Type(”&mFormName.”)=“O” And !Isnull(&mformname.))
lccmd=“Do Form &cformname Name &mformname”
lcCmd = lcCmd + IIF(EMPTY(strPara),""," WITH "+strPara )
&lccmd
Else
If &mformname…WindowState=1
&mformname…WindowState=0
Endif
&mformname…Show
Endif
Endproc

Calling method

runform( Form file name , Form definition variables , Parameters 1,[- Parameters 10])
With no arguments
runform(“ Forms 2”,“ Forms 2”)
Run with parameters ( Support 10 Parameters )
runform(“ Forms 2”,“ Forms 2”,“123”,“456”,“12345”)
More information http://www.sn58.cn

原网站

版权声明
本文为[VFP of Garfield]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202200535523718.html