比如有一个数组label1(i),里面的是“√”“×”,我现在想把label1(i)数组里caption值凡是“×”的选出来,我用代码 if label1(i).caption="×" then... 这样的语句不正确
你试试这样子For i = 0 To 3 If label1(i).Caption = "×" Then MsgBox i End If Next请确认前后×的一致 最好定义成常量 public const strErr as string ="×" public const strOK as string ="√" 然后后面都用这两个常量给caption赋值以及作为条件判断
for i=0 to 3 是什么意思阿?
你label1的下标的LBound UBound
是循环搜寻所有label1的数组内容啊, 你按你实际的修改过去就可以了 如你有从0到10,那就for i=0 to 10 ....
你label1的下标的LBound UBound?
For b = 0 To UBound(Label5(a)) If Label5(b).Caption = "×" Then end if next b 也不对说我没有数组
if label1(i).caption="×"
then...
这样的语句不正确
If label1(i).Caption = "×" Then
MsgBox i
End If
Next请确认前后×的一致
最好定义成常量
public const strErr as string ="×"
public const strOK as string ="√"
然后后面都用这两个常量给caption赋值以及作为条件判断
如你有从0到10,那就for i=0 to 10 ....
If Label5(b).Caption = "×" Then
end if
next b
也不对说我没有数组
至于最大有多少,你自己应该知道的吧, 比如100 , 那就for i=0 to 100 了
另外 控件组 , ubound不认的
for each lbl in label5
if lbl.caption="x" then
else
end if
next lbl