vb判断多个值

来源:百度知道 编辑:UC知道 时间:2024/04/28 22:27:48
vb6.0里 假如有100个文字框 想要判断他们的值都不为空 只能用textbox1.value and....and textbox100.value么 谁有更简便的方法?谢!
再补充一个问题...怎样判断msgbox弹出的次数?

建立一个TEXTBOX控件将其Index属性设为0
Private Sub Form_Load()
Dim intCount As Integer
For intCount = 1 To 2
Load Text1(intCount)
Text1(intCount).Visible = True
Text1(intCount).Top = Text1(intCount).Top + 300
Next intCount
End Sub

Private Function Judge() As Long
Dim tbText As TextBox
Dim intCount As Integer
Dim intTimes As Integer
For intCount = 0 To 2
Set tbText = Text1(intCount)
If tbText.Text = "" Then
'intTimes即为弹出次数
intTimes = intTimes + 1
MsgBox tbText.Index & " 的值为空"
tbText.SetFocus
Exit For
End If
Next intCount
End Function

选中Text1控件,Ctrl+c 再ctrl+v 99次.建个text1的数组控件

for i=0 to 99
if text1(i).text="" then '判断
msgbox "为空"
else
msgbox "不为空"
endif

next