作业帮 > 数学 > 作业

VB中 dim a as integer ,如果在某个事件中想写这样的代码,text1(a).forcolor=***,

来源:学生作业帮 编辑:作业帮 分类:数学作业 时间:2024/07/07 10:58:32
VB中 dim a as integer ,如果在某个事件中想写这样的代码,text1(a).forcolor=***,但是a 的范围是
但是a的范围是 for a=0 to 15 和 for a =18 to 20,现在我这样写的:
for a=0 to15
text(a).forecolor=***
next
for a =18 to 20
text(a).forecolor=***
next
如果变量a需要断开分了很多段就要写很多次,能简化吗
后面的***是相同的参数
可以这样简化,但意义似乎不大
for a=0 to20
if a=18 then
text(a).forecolor=***
endif
next
再问: 没看懂,解释一下好吗
再答: 汗…… 有哪里不懂呢? 注释部分的英语意思是:把你需要执行的代码放在那里。