I have searched a lot to find a solution for my problem, but I can't find any specific solution.
I need to change a value which is stored under HKEY_LOCAL_MACHINE\SOFTWARE\APP_NAME
. It is not possible to use .NET's registry functions, since they have drastic restrictions.
The following snippet should solve my problem:
Dim regKey As RegistryKey
Dim ver As Decimal
regKey = My.Computer.Registry.LocalMachine.OpenSubKey("HKEY_LOCAL_MACHINE\SOFTWARE\APP_NAME", True)
regKey.SetValue("IP", "192.168.10.15:18500") regKey.Close()
Unfortunately, I get a NullReferenceExeption when I try to set the value.
What should I do? I have imported Microsoft.Win32 and RegistryKey doesn't accept any constructor.