Reading from and Writing to the Registry Using My (Visual Basic)
The My.Computer.Registry object offers methods and properties for working with registry keys.
The Windows registry hosts information from the operating system as well as information from applications hosted on the computer. Although My.Settings is recommended for storing such information, legacy applications may make use of the registry.
Tasks
The following table lists examples of tasks for registry keys involving the My.Computer.Registry object.
To |
See |
Create a registry key |
How to: Create a Registry Key and Set Its Value in Visual Basic |
Delete a registry key |
|
Determine whether a value exists |
How to: Determine if a Value Exists in a Registry Key in Visual Basic |
Read a value |
Security and the Registry
Working with the registry may compromise security by allowing inappropriate access to system resources or protected information. To use these properties, you must have read and write permissions from the RegistryPermissionAccess enumeration, which controls access to registry variables. Any code running with full trust (under the default security policy, this is any code installed on the user's local hard disk) has the necessary permissions to access the registry.
Registry variables should not be stored in memory locations where code without RegistryPermission can access them. Similarly, when granting permissions, grant the minimum privileges necessary to get the job done.
See Also
Tasks
Troubleshooting: Manipulating the Registry (Visual Basic)