IWMSNamedValues.Remove (Visual Basic .NET)

banner art

Previous Next

IWMSNamedValues.Remove (Visual Basic .NET)

The Remove method removes a name-value pair from the IWMSNamedValues collection.

Syntax

  IWMSNamedValues
  .Remove(
  varIndex As Variant
)

Parameters

varIndex

[in] Variant containing either the name, the index number, or the name-value pair.

Return Values

If this method succeeds, it does not return a value. If it fails, it returns an error number.

Number Description
0x8002000B varIndex is an invalid index location.

Example Code

Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices

Private Sub RemoveProperty()

    ' Declare variables.
    Dim Server As WMSServer
    Dim NamedValues As IWMSNamedValues
    Dim NamedValue As IWMSNamedValue
    Dim strName As String
    Dim varIndex As Object
    Dim varValue As Object

Try
    ' Create the WMSServer object.
    Server = New WMSServer()

    ' Retrieve the IWMSNamedValues object
    ' containing descriptive information about the server.
    NamedValues = Server.Properties

    ' Add a new property to the collection of name-value pairs.
    strName = "System Administrator"
    varValue = "Bob Jenkins"
    NamedValue = NamedValues.Add(strName, varValue)

    ' Remove the newly added property from the collection.
    varIndex = "System Administrator"
    NamedValues.Remove(varIndex)

Catch excCom As COMException
    ' TODO: Handle COM exceptions.
Catch exc As Exception
    ' TODO: Handle errors.
Finally
    ' TODO: Clean-up code goes here.
End Try

End Sub

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003 family, Windows Server 2008 family.

See Also

Previous Next