VB 如何对控件数组进行批量操作?

来源:百度知道 编辑:UC知道 时间:2024/05/30 10:12:41
有一个文本框数组,TextIn(0)----TextIn(39),及一个按钮,点击按钮时,判断,当这些文本框中全为空时,用msgbox给出提示,请问有没有简便方法实现判断?

反向思维:检查是否存在不为空
Dim H as Boolean
For i=0 to 39
If TextIn(i).Text<>"" Then H=True
Next
If H=False Then MsgBox "全为空"

Private Sub Command1_Click()

For i = 0 To TextIn.ubound
If TextIn(i).Text <> "" Then Exit Sub
Next i
If i = TextIn.ubound + 1 Then MsgBox "全为空"

End Sub

for next循环
Dim a as Boolean
For i=0 to 39
If TextIn(i).Text<>"" Then a=True
Next
If a=False Then
MsgBox “全部删除"

j=-1
for i=0 to textln.ubound
if textln(i).text="" then j=j+1
next
if j=textln.ubound then msgbox "全为空"