Export (0) Print
Expand All

Interaction.GetAllSettings Method

Returns a list of key settings and their respective values (originally created with SaveSetting) from an application's entry in the Windows registry. Using the My feature gives you greater productivity and performance in registry operations than GetAllSettings. For more information, see Registry.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public static string[,] GetAllSettings(
	string AppName,
	string Section
)

Parameters

AppName
Type: System.String

Required. String expression containing the name of the application or project whose key settings are requested.

Section
Type: System.String

Required. String expression containing the name of the section whose key settings are requested. GetAllSettings returns an object that contains a two-dimensional array of strings. The strings contain all the key settings in the specified section, plus their corresponding values.

Return Value

Type: System.String[,]
Returns a list of key settings and their respective values (originally created with SaveSetting) from an application's entry in the Windows registry.
Using the My feature gives you greater productivity and performance in registry operations than GetAllSettings. For more information, see Registry.

ExceptionCondition
ArgumentException

User is not logged in.

GetAllSettings returns an uninitialized Object if either AppName or Section does not exist.

Because it operates under the HKEY_LOCAL_USER registry key, which is not active until a user logs on interactively, GetAllSettings requires that a user be logged on.

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.

This example first uses the SaveSetting function to make entries in the Windows registry for the application specified as AppName, then uses the GetAllSettings function to display the settings. Note that application names and Section names cannot be retrieved with GetAllSettings. Finally, the DeleteSetting function removes the application's entries.

' Object to hold 2-dimensional array returned by GetAllSettings. 
' Integer to hold counter. 
Dim MySettings(,) As String 
Dim intSettings As Integer 
' Place some settings in the registry.
SaveSetting("MyApp", "Startup", "Top", "75")
SaveSetting("MyApp", "Startup", "Left", "50")
' Retrieve the settings.
MySettings = GetAllSettings("MyApp", "Startup")
For intSettings = LBound(MySettings, 1) To UBound(MySettings, 1)
    WriteLine(1, MySettings(intSettings, 0))
    WriteLine(1, MySettings(intSettings, 1))
Next intSettings
DeleteSetting("MyApp")

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft