Check for empty TextBox controls in VB.NET

前端 未结 7 1849
离开以前
离开以前 2020-12-06 13:01

Ive got a Form application in VB.NET.

I have many text boxes on one form (about 20). Is there anyway to check them all at once to see if they are empty instead of wr

相关标签:
7条回答
  • 2020-12-06 13:28

    If TextBox field is empty then the message box will appear saying "Complete Entry!".

    Dim t
    For Each t In Me.Controls
        If TypeOf t Is TextBox Then
            If t.Text = "" Then
                MsgBox("Complete Entry!")
                Exit Sub
                Exit For
            End If
        End If
    Next
    
    0 讨论(0)
提交回复
热议问题