[求助]代码问题
请问各位高手,以下代码有错吗?thisform.Lebel1.caption=""
thisform.Lebel2.caption=""
thisform.Lebel3.caption=""
thisform.Lebel4.caption=""
thisform.Lebel5.caption=""
thisform.Lebel6.caption=""
..............
for i=1 to thisform.list2.listcount
thisform.Lebeli.caption=thisform.list2.list(i-1)
endfor
在运行过程中,总出现语法错误,不能识别成员"LEBEL1,....."
原因何在呢?
ci=alltrim(str(i))
thisform.Lebel&ci..caption=thisform.list2.list(i-1)&&i-1可能为i
endfor
Label不能改Lebel
thisform.Label1.caption=""thisform.Label2.caption=""
thisform.Label3.caption=""
thisform.Label4.caption=""
thisform.Label5.caption=""
thisform.Label6.caption=""
..............
for i=1 to thisform.list2.listcount
thisform.Labeli.caption=thisform.list2.list(i-1)
endfor
是不是要在某一个“Lebel”显示“list2”某一行的数据
[quote][bo][un]TZTJ[/un] 在 2008-6-18 22:48 的发言:[/bo]请问各位高手,以下代码有错吗?
thisform.Lebel1.caption=""
thisform.Lebel2.caption=""
thisform.Lebel3.caption=""
thisform.Lebel4.caption=""
thisform.Lebel5.caption=""
thisform.Lebel6.caption=""
.. ...
for i=1 to thisform.list2.listcount
thisform.Labeli.caption=thisform.list2.list(i-1)
endfor
[/quote]
是不是要在某一个“Lebel”显示“list2”某一行的数据?
如是,则:
c变量1="thisform.Label"+alltrim(str(i))+".caption"
c变量2="thisform.list2.list(i-1)" && 或者 c变量2="thisform.list2.list("+alltrim(str(i-1))+")"
&c变量1 = &c变量2
但请注意,i必须>1,则 i-1>0 感谢各位高手,近来由于网络不通,不能及时回贴,实在抱歉。 请教版主,为什么代码thisform.Label&ci..caption=thisform.list2.list(i)必须有“..”而单有“.”不成呢? “&ci.”是固定搭配,宏替换函数,只是很多情况下我们只写成&ci是因为其后为空格。现在Label&ci的后面还有别的内容,就加上这个小数点作为与别的内容的分割符。若只加一个点,则当ci=1的时候,那结果就变成Label1Caption了;若加了二个点,则会出现Label1.Caption 谢谢版主耐心的指点
页:
[1]
