Compartilhar via


System.Gadget.Settings.writeString method

[ The Windows Gadget Platform/Sidebar is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. ]

Stores a String value with an associated Settings key.

Syntax

System.Gadget.Settings.writeString(
  strName,
  strValue
)

Parameters

strName [in]

String that specifies the name of the Settings key.

strValue [in]

Note

The Windows Gadget Platform/Sidebar is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.

The String value to store.

Return value

This method does not return a value.

Remarks

Use writeString for performance and efficiency reasons if the data type 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.writeString(
            "settingsUserEntry", txtUserEntry.value);
    }
    // Allow the Settings dialog to close.
    event.cancel = false;
}

Requirements

Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
End of client support
Windows 7
End of server support
Windows Server 2008
IDL
Sidebar.idl
DLL
Sidebar.Exe (version 1.00 or later)

See also

System.Gadget.Settings

readString