Check for empty TextBox controls in VB.NET

前端 未结 7 1872
离开以前
离开以前 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:12

    Sub for check Empty Textbox in GroupBox, you can use this:

    Public Sub CheckEmptyTextbox(Byval groupbox as GroupBox)
    
    Dim txt as control
    
    For Each txt in groupbox.Controls
    
      IF TypeOF txt is Textbox then
    
         IF txt.Text="" Then
    
    
          MsgBox("Please Input data to textbox.")
    
          Exit For
    
         End IF
    
      End IF
    
    Loop
    
    
    End Sub
    

提交回复
热议问题