System.Gadget.Settings.write Method

Stores a value of unspecified type with an associated Settings key.

Syntax

System.Gadget.Settings.write(
  strName,
  varValue
)

Parameters

  • strName [in]
    BSTR String that specifies the name of the Settings key.
  • varValue [in]
    VARIANT The value to store.

Return Value

This method does not return a value.

Remarks

Use writeString for performance and efficiency reasons if the datatype is a String.

There is a 1024 character limit for Settings keys and a 2048 character limit for Settings values; values longer than these limits will be truncated.

Use read or readString to read Settings values.

The Settings values are unique for each user account, even if the same gadget is used.

Examples

The following example demonstrates how to store a Settings value.

// --------------------------------------------------------------------
// Handle the Settings dialog closing event.
// Parameters:
// event - event arguments.
// --------------------------------------------------------------------
function SettingsClosing(event)
{
    // Save the settings if the user clicked OK.
    if (event.closeAction == event.Action.commit)
    {
        System.Gadget.Settings.write(
            "settingsSelectionIndex", selUserEntry.selectedIndex);
    }
    // Allow the Settings dialog to close.
    event.cancel = false;
}

Requirements

Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
IDL Sidebar.idl
DLL Sidebar.Exe version 1.00 or later

See Also

System.Gadget.Settings

 

 

Send comments about this topic to Microsoft

Build date: 2/24/2010

Build type: SDK