Interaction.DeleteSetting Method (String, String, String)
Deletes a section or key setting from an application's entry in the Windows registry. The My feature gives you greater productivity and performance in registry operations than the DeleteSetting function. For more information, see Registry .
Assembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
[HostProtectionAttribute(SecurityAction.LinkDemand, Resources = HostProtectionResource.ExternalProcessMgmt)] public static void DeleteSetting( string AppName, string Section = null, string Key = null )
Required. String expression containing the name of the application or project to which the section or key setting applies.
Required. String expression containing the name of the section from which the key setting is being deleted. If only AppName and Section are provided, the specified section is deleted along with all related key settings.
Optional. String expression containing the name of the key setting being deleted.
If all arguments are provided, the specified setting is deleted. A run-time error occurs if you attempt to use DeleteSetting on a nonexistent section or key setting.
DeleteSetting requires that a user be logged on since it operates under the HKEY_LOCAL_USER registry key, which is not active until a user logs on interactively.
Registry settings that are to be accessed from a non-interactive process (such as Mtx.exe) should be stored under either the HKEY_LOCAL_MACHINE\Software\ or the HKEY_USER\DEFAULT\Software registry keys.
The following example first uses the SaveSetting procedure to make entries in the Windows registry for the MyApp application, and then uses the DeleteSetting function to remove them. Because no Key argument is specified, the whole Startup section is deleted, including the section name and all of its keys.
Available since 1.1