ExceptionRoutedEventArgs.ErrorException 属性

定义

获取导致错误条件的异常。

public:
 property Exception ^ ErrorException { Exception ^ get(); };
public Exception ErrorException { get; }
member this.ErrorException : Exception
Public ReadOnly Property ErrorException As Exception

属性值

详细说明特定错误条件的异常。

例外

拒绝访问媒体文件的尝试。

找不到媒体文件。

任何已安装的编解码器都不支持媒体文件格式。

-或-

无法识别文件格式。

未检测到Windows Media Player版本 10 或更高版本。

-或-

视频资源不足以播放媒体。

此时会显示 COM 错误代码。

示例

以下示例创建一个简单的事件处理程序。ExceptionRoutedEventArgs

private void Media_MediaFailed(object sender, ExceptionRoutedEventArgs args)
{
    MessageBox.Show(args.ErrorException.Message);
}
Private Sub Media_MediaFailed(ByVal sender As Object, ByVal args As ExceptionRoutedEventArgs)
    If (True) Then
        MessageBox.Show(args.ErrorException.Message)
    End If
End Sub

适用于