I stumbled on this by mistake. I had a case where I was setting ErrorProviders text (calling SetError and passing in the control with text) on a controls whose Visible property was set to True at runtime.
One would think you'd get an exception, but you do not. The error provider is happy in this case. So, as a work around I show a dialog if the control is not visible.
I know, why is a validated control not visible, long story.
PrivateSub SetCboSesErrorProviderValue(ByVal session As String)
If Me.IsConference AndAlso Me.LeaderIsAssignedToSession(session) Then
ErrorProvider.SetError(Me.cboSes, "Leader is already assigned to session " & session & ".")
If Not Me.cboSes.Visible Then
AlertBox.Show(Me, Me._leaderName.Trim() & " has already been assigned as a leader to this event.", _
"Leader Already Assigned to Event", Windows.Forms.MessageBoxButtons.OK, _
End Sub ' SetCboSesErrorProviderValue
Just received my complimentary copy of Brian's book. Nice to see he thanked me in his Acknowledgments section. Having read the book once pre-publishing it will be neat to read it again after my review to see what was revised.