BaseForm.DisplayErrorMessage(Exception, ResourceManager) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Displays the error message from the exception thrown by the IServiceProvider interface.
protected:
virtual void DisplayErrorMessage(Exception ^ ex, System::Resources::ResourceManager ^ resourceManager);
protected virtual void DisplayErrorMessage (Exception ex, System.Resources.ResourceManager resourceManager);
abstract member DisplayErrorMessage : Exception * System.Resources.ResourceManager -> unit
override this.DisplayErrorMessage : Exception * System.Resources.ResourceManager -> unit
Parameters
- ex
- Exception
The exception thrown by the IServiceProvider interface.
- resourceManager
- ResourceManager
The ResourceManager that contains culture-specific resources.
Examples
The following example duplicates the base class implementation of the DisplayErrorMessage method.
protected override void DisplayErrorMessage(Exception ex,
ResourceManager resourceManager) {
string errorText = null;
string errorMessage = null;
ModuleServiceProxy.GetErrorInformation(ex,
resourceManager, out errorText, out errorMessage);
string errorString = String.Empty;
if (String.IsNullOrEmpty(errorText)) {
errorText = "Unknown Error Message";
errorString = errorText + "Error Details \n"
+ errorMessage;
} else {
errorString = errorText;
}
ShowError(null, errorString, false);
}
Remarks
This method calls the GetErrorInformation method to return the error message.
The returned error message is passed to the ShowError method.