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.
The following table lists examples of tasks for registry keys involving the My.Computer.Registry object.
Create a registry key
Delete a registry key
Determine whether a value exists
Read a value
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.