Share via


IWMSNamedValues.Add (Visual Basic .NET)

banner art

Previous Next

IWMSNamedValues.Add (Visual Basic .NET)

The Add method adds an IWMSNamedValue object to the IWMSNamedValues collection.

Syntax

  IWMSNamedValues.Add(
  strName As String,
  varValue As Variant
)

Parameters

strName

[in] String containing the name.

varValue

[in] Variant containing the value. The default value is a zero-length string.

Return Values

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

Number Description
0x8007000E There is insufficient memory to complete the function.
0xC00D1396L strName contains an invalid character. Invalid characters are: & " ' < > \ and the ANSI characters 0-31 and 127.
0xC00D1392L varValue is greater than the maximum length allowed.
0xC00D138BL varValue is an unsupported type.

Remarks

You can use any Variant data type except Date.

Example Code

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

Private Sub AddProperty()

    ' Declare variables.
    Dim Server As WMSServer
    Dim NamedValues As IWMSNamedValues
    Dim NamedValue As IWMSNamedValue
    Dim strName As String
    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)

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