Skip to Content
VB.NET Language in a Nutshell, Second Edition
book

VB.NET Language in a Nutshell, Second Edition

by Steven Roman PhD, Ron Petrusha, Paul Lomax
April 2002
Intermediate to advanced
688 pages
19h 51m
English
O'Reilly Media, Inc.
Content preview from VB.NET Language in a Nutshell, Second Edition

Name

SaveSetting Procedure

Class

Microsoft.VisualBasic.Interaction

Syntax

SaveSetting(appname, section, key, setting)
appname (required; String)

The name of the application

section (required; String)

The name of the registry key

key (required; String)

The name of the value entry whose value is to be saved

setting (required; String or numeric)

The value to save

Description

Creates or saves an entry for a VB application in the Windows registry

Rules at a Glance

  • If either the appname or section subkeys are not found in the registry, they are automatically created.

  • The function writes a value to a subkey of the KEY_CURRENT_USER\Software\ VB and VBA Program Settings key of the registry.

  • section need not be an immediate subkey of appname; instead, section can be a fully qualified path to a nested subkey, with each subkey separated from its parent by a backslash. For example, a value of Settings\Coordinates for the section argument indicates that the value is to be retrieved from HKEY_CURRENT_USER\Software\VB and VBA Program Settings\appname\Settings\Coordinates.

  • Visual Basic writes setting to the registry as a string (REG_SZ) value. If setting is not a string, VB attempts to coerce it into a string in order to write it.

  • If the setting cannot be saved, a runtime error will be generated.

Programming Tips and Gotchas

  • The built-in registry-manipulation functions allow you to create professional 32-bit applications that use the registry for holding application-specific data, in the same way that .INI ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

VB .NET Language in a Nutshell

VB .NET Language in a Nutshell

Steven Roman PhD, Ron Petrusha, Paul Lomax

Publisher Resources

ISBN: 0596003080Supplemental ContentCatalog PageErrata