Error Event of the AxWindowsMediaPlayer Object

The Error event occurs when the Windows Media Player control has an error condition.

private void player_ErrorEvent(
  object sender,
  System.EventArgs e

[Visual Basic]
Private Sub player_ErrorEvent(  
  sender As Object,  
  e As System.EventArgs
) Handles player.ErrorEvent

Event Data

This event does not contain data.


The following example creates an event handler for the Error event to display the description text for the first error in the error queue. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

// Add a delegate for the Error event.
player.ErrorEvent += new EventHandler(player_ErrorEvent);

private void player_ErrorEvent(object sender, System.EventArgs e)
    // Get the description of the first error. 
    string errDesc = player.Error.get_Item(0).errorDescription;

    // Display the error description.

Public Sub player_ErrorEvent(ByVal sender As Object, ByVal e As System.EventArgs) Handles player.ErrorEvent

    ' Get the description of the first error. 
    Dim errDesc As String = player.Error.Item(0).errorDescription

    ' Display the error description.

End Sub


Windows Media Player 9 Series or later
AxInterop.WMPLib.dll (AxInterop.WMPLib.dll.dll)

See also

AxWindowsMediaPlayer Object (VB and C#)

IWMPError.Item (VB and C#)

IWMPErrorItem.errorDescription (VB and C#)