vbDeleteSetting Command

Purpose

Deletes a section or a key setting from an entry in the Windows registry using VB compatible registry commands.

Syntax

vbDeleteSetting appName$, [section$] [, key$]

Description

Deletes a section or key setting in the Visual Basic standard registry location for storing program information for applications created in Visual Basic:

HKEY_CURRENT_USER\Software\VB and VBA Program Settings\appName\section\key

The registry stores data in a hierarchically structured tree. Each node in the tree is called a key. Each key can contain both subkeys and data entries called values.

The vbDeleteSetting function syntax has these arguments:

appName - Required. String expression containing the name of the application or project to which the section or key setting applies. May include section in GFA-BASIC 32.

section - Optional. String expression containing the name of the section where the key setting is found. 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 to return.

Example

vbSaveSetting "MyApp", "Startup", "Top", 75

vbSaveSetting "MyApp", "Startup", "Left", 50

Debug vbGetSetting("MyApp", "Startup", "Left", , 25)

vbDeleteSetting "MyApp", "Startup"

vbDeleteSetting "MyApp"

Remarks

vbDeleteSetting does not work in the same fashion as they do with non-nested keys. This means that the command won't delete subkeys recursively. Use more than one vbDeleteSetting statement to remove sections of the nested keys before removing the top level key, rather than attempting to remove the top key in isolation. See example.

See Also

vbDeleteSetting, vbGetSetting, vbGetSettingType, GetSetting, GetSettingType, SaveSetting, DeleteSetting, CreateRegKey, OpenRegKey, CloseRegKey, GetRegVal, GetRegValName, GetRegValType, GetRegValNameCount, GetRegSubKey, GetRegSubKeyCount

{Created by Sjouke Hamstra; Last updated: 25/10/2014 by James Gaite}