[Extension Method][VB.NET]ErrorProvider.GerErrorMsgs amp; ErrorProvider.HasError
Public Module ErrorProviderExtension
<Extension()> _
Public Function GetErrorMsgs(ByVal ep As ErrorProvider) As String()
If ep.ContainerControl Is Nothing Then
Return New String() {}
End If
Dim linq = From c In ep.ContainerControl.Controls Let msg = ep.GetError(c) Where msg.Length > 0 Select msg
Return linq.ToArray
End Function
<Extension()> _
Public Function HasError(ByVal ep As ErrorProvider) As Boolean
Return ep.GetErrorMsgs.Length > 0
End Function
End Module