Udostępnij za pośrednictwem


My.Computer.Registry Object

Provides properties and methods for manipulating the registry.

Remarks

To use these properties, you must have Read and Write permission from the RegistryPermissionAccess Enumeration. Any code running with full trust (under the default security policy, this is any code installed on the user's local hard drive) has the necessary permissions to access the registry. For more information, see RegistryPermission Class.

Tasks

The following table lists examples of tasks involving the My.Computer.Registry object.

To

See

Create a registry key

How to: Create a Registry Key and Set Its Values in Visual Basic

Determine if a value in a registry key exists

How to: Determine if a Value Exists in a Registry Key in Visual Basic

Write data to a registry key

How to: Set Values in Registry Keys in Visual Basic

Delete a registry key

How to: Delete a Registry Key in Visual Basic

Read data from the registry

How to: Read a Value from a Registry Key in Visual Basic

Example

This example reads the value Name from HKEY_CURRENT_USER\Software\MyApp and displays it in a message box.

Dim readValue As Object
        readValue = My.Computer.Registry.GetValue _
        ("HKEY_CURRENT_USER\Software\MyApp", "Name", Nothing)
        MsgBox("The value is " & CStr(readValue))

Requirements

Namespace:Microsoft.VisualBasic.MyServices

Class:RegistryProxy (provides access to Registry)

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

See Also

Tasks

Troubleshooting: Manipulating the Registry

Concepts

Common Registry Tasks

Reference

My.Computer.Registry Object Members

My.Computer.Registry.ClassesRoot Property

My.Computer.Registry.CurrentConfig Property

My.Computer.Registry.CurrentUser Property

My.Computer.Registry.DynData Property

My.Computer.Registry.LocalMachine Property

My.Computer.Registry.PerformanceData Property

My.Computer.Registry.Users Property

My.Computer.Registry.GetValue Method

My.Computer.Registry.SetValue Method

My.Computer Object

Microsoft.Win32.Registry

Other Resources

Walkthrough: Creating a Registry Key and Changing Its Values