Troubleshooting: Manipulating the Registry (Visual Basic)
In working with the registry, you may encounter specific exceptions. This topic lists the most common exceptions and provides suggestions on how to address each of them.
The following table lists exceptions that may occur while working with the registry and provides tips on how to address them.
Make sure the key you are performing an operation on exists, and that the path you have supplied is both correct and not over 255 characters.
Make sure you have read and write permissions from RegistryPermissionAccess.
Make sure the key was opened for writing if attempting to write to it.