Text1内容不能为空怎么表示

来源:百度知道 编辑:UC知道 时间:2024/06/07 08:40:06

呵呵,判断的方法有多种:

If Trim(Text1.Text) = "" Then
MsgBox "没有数据"
Exit Sub '退出过程
End If

If Trim(Text1.Text) = vbNullString Then
MsgBox "没有数据"
Exit Sub '退出过程
End If

If Len(Text1.Text) = 0 Then
MsgBox "没有数据"
Exit Sub '退出过程
End If

Private Sub Text1_LostFocus()
If Text1 = "" Then
MsgBox ("Text内容不能为空")
Text1.SetFocus
End If
End Sub