Good one, i was trying almost the same thing but including an errorProvider to avoid message Box popping for every error and likely annoying the user.. So please review the code below and advise why this doesnt always show the errorProvder when there is no input
Dim isValid As Boolean = False
For Each c As Control In Me.TableLayoutPanel1.Controls
If TypeOf c Is TextBox Then
If (CType(c, TextBox).Text.Trim() = String.Empty) Then
ErrorProvider1.SetError(c, "Required field.")
isValid = False
Exit For
Else 'If (CType(c, TextBox).Text.Trim() String.Empty) Then
ErrorProvider1.SetError(c, "")
isValid = True
Continue For
End If
End If
Next
Return isValid
Good one, i was trying almost the same thing but including an errorProvider to avoid message Box popping for every error and likely annoying the user.. So please review the code below and advise why this doesnt always show the errorProvder when there is no input