Visual Basic Concepts

Deleting Application Settings

You can use the DeleteSetting statement to delete a registry key, section, or an application's registry location. For example, you may want to delete all registry information for an application when the application is uninstalled.

Use the following syntax for the DeleteSetting statement:

DeleteSetting(appname, section, key)

The following code deletes the LastEntry key in the "RegCust" application's Startup section.

Private Sub cmdDelKey_Click()
   DeleteSetting "RegCust", "StartUp", "LastEntry"
End Sub

The following code deletes the "RegCust" application's entire Startup section of the registry.

Private Sub cmdDelSection_Click()
   DeleteSetting "RegCust", "StartUp"
End Sub

The following code deletes the entire registry location for the "RegCust" application.

Private Sub cmdUnInstall_Click()
   DeleteSetting "RegCust"
End Sub

For More Information   See "DeleteSetting Statement."