Read and write to the registry with VB.NET

registry, vb.net

Solution

You must open Registry sub Key before read or write. Then you can read or write

Dim regKey As RegistryKey
Dim Value As Object
regKey =My.Computer.Registry.CurrentUser.OpenSubKey("HKEY_CURRENT_USER\Software\VB_and_VBA_Program_Settings", True)
'Here u can read value of AppName
Value = regKey.GetValue("AppName", "Default Value")
'Or u can write the value
  value=regkey.setValue("AppName", "myApp")
regKey.Close()

Problem

I made a game and I would like to store the high score and other values in the windows registry. It's made in VB.NET. Could someone give me a sample code example of simple reading and writing to the registry. Thanks

Original source