You are trying to do it too complicated. I am not in front of the computer so maybe the code have minor errors:
If CheckMyControls() = False Then
MessageBox.Show("Give Compleate Data!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)
coloring()
Else
MessageBox.Show("Success", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
End Sub
Public Sub coloring()
For Each cntrl In Me.Controls
Select Case cntrl.GetType
Case GetType(ComboBox)
If cntrl.Text = "Select" Then
cntrl.BackColor = Color.Red
Exit For
End If
Case GetType(MaskedTextBox)
If cntrl.Text = "" AndAlso cntrl.Name <> "MTXTPFESI" Then
cntrl.BackColor = Color.Red
End If
Case Else
If cntrl.Text = "" Then
cntrl.BackColor = Color.Red
End If
End Select
Next
End Sub
Public Function CheckMyControls() As Boolean
Dim bEmptyControlFlag As Boolean
For Each cntrl In Me.Controls
Select Case cntrl.GetType
Case GetType(ComboBox)
If cntrl.Text = "Select" Then
bEmptyControlFlag = True
Exit For
End If
Case Else
If cntrl.Text = "" Then
bEmptyControlFlag = True
End If
End Select
Next
Return Not bEmptyControlFlag
End Function