DeleteSetting Statement

Description

Deletes a section or key setting from an application's entry in the Windows registry.

Syntax

DeleteSetting appname, section[, key]

The DeleteSetting statement syntax has these named arguments

Part

Description

appname

Required. String expression containing the name of the application or project to which the section or key setting applies.

section

Required. String expression containing the name of the section where the key setting is being deleted. If only appname and section are provided, the specified section is deleted along with all related key settings.

key

Optional. String expression containing the name of the key setting being deleted.


Remarks

If all arguments are provided, the specified key setting is deleted. However, the DeleteSetting statement does nothing if the specified section or key setting does not exist.

See Also

GetAllSettings function, GetSetting function, SaveSetting statement.

Example

The following example first uses the SaveSetting statement to make entries in the Windows registry (or .ini file on 16-bit Windows platforms) for the MyApp application, and then uses the DeleteSetting statement to remove them. Because no key argument is specified, the whole section is deleted, including the section name and all its keys.

' Place some settings in the registry.
SaveSetting appname := "MyApp", section := "Startup", _
    key := "Top", setting := 75 
SaveSetting "MyApp","Startup", "Left", 50 
' Remove section and all its settings from registry.
DeleteSetting "MyApp", "Startup"