Calling Services from Forms
When you use asynchronous web services you define a callback subroutine which is called when the service returns the results.
When using asynchronous web services in a Windows Form it is possible that the service is unavailable or takes too long to retrieve the data. In this situation the user will probably close the form before any result or message has been returned.
In this situation the callback might still occur even after the form has been closed.
It is important to check for this in the callback subroutine.
If the form has been closed then there is obviously nothing to do.
If (Me.IsDisposed = True) Then Exit Sub
'form has been closed if this property is set to true
Catch ex As System.ServiceModel.EndPointNotFoundException
Catch ex As System.ServiceModel.ActionNotSupportedException