IRegistryKey.WriteString

Syntax

WriteString(ValueName: String; Value: String);

Parameters

ValueName. Name of the parameter, which value should be changed.

Value. Value that should be set for parameter in the registry.

Description

The WriteString method changes string parameter value.

Comments

If the parameter or subkey do not exist, it is created automatically. If the parameter exists, the type and value is changed according to the entered data. If it is required to change value of the default parameter, pass empty string ("") as a name.

Example

Executing the example requires that the registry contains a parameter named Param1 located in the subkey [HKEY_CURRENT_USER\Software\MyProject\Params].

Add a link to the Registry system assembly.

Sub UserProc;
Var
    RegKey, SubKey: IRegistryKey;
Begin
    
// Get subkey with user settings
    RegKey := RegistryClass.CurrentUser;
    SubKey := RegKey.OpenSubKey(
"Software\MyProject\Params"True);
    
// Set string value for parameter
    SubKey.WriteString("Param1""New Line");
End Sub UserProc;

After executing the example, the parameter named Param1 located in the subkey [HKEY_CURRENT_USER\SOFTWARE\MyProject\Params] is set to New Line.

See also:

IRegistryKey