Public Function Rangelimit(ByRef A() As Object, ByRef n As Integer) for i = 0 to ubound(A) If A(i).text > n Then MsgBox "输入数据不能大于" & n, 64, "输入提示" A(i).BackColor = vbRed Else A(i).BackColor = vbWhite End If next End Function
好像不可以哦,比如我在窗体上加TEXT1(0)、TEXT1(1)、TEXT1(2),我在text1_change(index as integer)事件下写:call Rangelimit(text1(),500) 运行会报错的?为什么?
for i = 0 to ubound(A)
If A(i).text > n Then
MsgBox "输入数据不能大于" & n, 64, "输入提示"
A(i).BackColor = vbRed
Else
A(i).BackColor = vbWhite
End If
next
End Function
call Rangelimit(text1,500)
for i= 0 to text1.ubound
call Rangelimit(text1(i),500)
next