| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1124 人关注过本帖
标题:[求助]代码问题
只看楼主 加入收藏
TZTJ
Rank: 3Rank: 3
等 级:论坛游侠
威 望:1
帖 子:737
专家分:115
注 册:2008-1-15
结帖率:100%
收藏
 问题点数:0 回复次数:7 
[求助]代码问题
请问各位高手,以下代码有错吗?
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,....."
原因何在呢?
搜索更多相关主题的帖子: thisform 代码 caption Lebeli 
2008-06-18 22:48
Tiger5392
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:88
帖 子:2775
专家分:2237
注 册:2006-5-17
收藏
得分:0 
for i=1 to thisform.list2.listcount
  ci=alltrim(str(i))
  thisform.Lebel&ci..caption=thisform.list2.list(i-1)&&i-1可能为i
endfor

感言:学以致用。 博客:http://www./blog/user14/65009/index.shtml email:Tiger5392@
2008-06-19 09:30
qjbzjp
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:尧的故乡
等 级:贵宾
威 望:48
帖 子:1914
专家分:4397
注 册:2007-3-14
收藏
得分:0 
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
2008-06-21 14:59
午丁
Rank: 1
等 级:新手上路
威 望:1
帖 子:71
专家分:0
注 册:2008-3-19
收藏
得分:0 
是不是要在某一个“Lebel”显示“list2”某一行的数据
[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

是不是要在某一个“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
2008-06-21 19:32
TZTJ
Rank: 3Rank: 3
等 级:论坛游侠
威 望:1
帖 子:737
专家分:115
注 册:2008-1-15
收藏
得分:0 
感谢各位高手,近来由于网络不通,不能及时回贴,实在抱歉。
2008-06-27 22:15
TZTJ
Rank: 3Rank: 3
等 级:论坛游侠
威 望:1
帖 子:737
专家分:115
注 册:2008-1-15
收藏
得分:0 
请教版主,为什么代码thisform.Label&ci..caption=thisform.list2.list(i)必须有“..”而单有“.”不成呢?
2008-06-27 23:12
Tiger5392
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:88
帖 子:2775
专家分:2237
注 册:2006-5-17
收藏
得分:0 
“&ci.”是固定搭配,宏替换函数,只是很多情况下我们只写成&ci是因为其后为空格。现在Label&ci的后面还有别的内容,就加上这个小数点作为与别的内容的分割符。若只加一个点,则当ci=1的时候,那结果就变成Label1Caption了;若加了二个点,则会出现Label1.Caption

感言:学以致用。 博客:http://www./blog/user14/65009/index.shtml email:Tiger5392@
2008-06-27 23:27
TZTJ
Rank: 3Rank: 3
等 级:论坛游侠
威 望:1
帖 子:737
专家分:115
注 册:2008-1-15
收藏
得分:0 
谢谢版主耐心的指点
2008-06-28 22:58
快速回复:[求助]代码问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015664 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved