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
Public Class freestyle
Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged
If Trim(TextBox3.Text) = "" And Me.Visible Then
MsgBox("fill in the textbox")
TextBox3.BackColor = Color.Yellow
Else
' MsgBox("great one !!!")
End If
End Sub
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
If Trim(TextBox2.Text) = "" And Me.Visible Then
MsgBox("fill in the textbox")
TextBox2.BackColor = Color.Yellow
Else
'MsgBox("great one !!!")
End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If Trim(TextBox1.Text) = "" Or Trim(TextBox2.Text) = "" Or Trim(TextBox3.Text) = "" And Me.Visible Then
MsgBox("Please fill the necesary", MsgBoxStyle.Critical, "Error")
TextBox1.Focus()
Else
MsgBox("Nice Work !!!")
End If
End Sub
Private Sub TextBox1_Leave(sender As Object, e As EventArgs) Handles TextBox1.Leave
If Trim(TextBox1.Text) = "" And Me.Visible Then
MsgBox("fill in the textbox")
TextBox1.BackColor = Color.Yellow
Else
' MsgBox("great one !!!")
End If
End Sub
End Class