Share via


Windows Media Player 11 SDK AxWindowsMediaPlayer.Error Event (VB and C#) 

Windows Media Player SDK banner art

Previous Next

AxWindowsMediaPlayer.Error Event (VB and C#)

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

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

[C#]
private void player_ErrorEvent(
  object sender,
  System.EventArgs e
)

Event Data

This event does not contain data.

Example Code

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.

[Visual Basic]
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.
    System.Windows.Forms.MessageBox.Show(errDesc)

End Sub

FakePre-9ef3ec8394d3480592751429e61a966f-d2b22e605f9743e894c9562a1f4bbe42

// 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.
    System.Windows.Forms.MessageBox.Show(errDesc);
}

Requirements

Version: Windows Media Player 9 Series or later

Namespace: AxWMPLib

Assembly: AxInterop.WMPLib.dll (automatically generated by Visual Studio)

See Also

Previous Next