Share via


Windows Media Player 11 SDK IWMPMedia.name (VB and C#) 

Windows Media Player SDK banner art

Previous Next

IWMPMedia.name (VB and C#)

The name property gets or sets the name of the media item.

[Visual Basic]
Property name As String

[C#]
string name {get; set;}

Property Value

A System.String that is the name of the media item.

Remarks

Before using this property, you must have read access to the library. For more information, see Library Access.

Example Code

The following example uses name to change the name of the current media item. A text box allows the user to enter a new name, and the name is changed in response to the Click event of a button. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.

[Visual Basic]
Public Sub setNewName_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles setNewName.Click

    ' ...Add code to ensure that the TextBox contains a valid value.

    ' Store a WMPLib.IWMPMedia3 interface to the current media item. 
    Dim cm As WMPLib.IWMPMedia3 = player.currentMedia

    ' Change the name. 
    cm.name = nameText.Text

End Sub

FakePre-7697187f7e8c418b9278f4b808bed8c7-dc8c42a3ea5746c4bcb52fbec7dc7e5b

private void setNewName_Click(object sender, System.EventArgs e)
{
    // ...Add code to ensure that the TextBox contains a valid value.

    // Store a WMPLib.IWMPMedia3 interface to the current media item. 
    WMPLib.IWMPMedia3 cm = (WMPLib.IWMPMedia3)player.currentMedia;

    // Change the name. 
    cm.name = nameText.Text;
}

Requirements

Version: Windows Media Player 9 Series or later

Namespace: WMPLib

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

See Also

Previous Next