[VB.NET] Reading and Writing to the Registry

This is a piece from my Final fantasy 11 Configurator that I made back when I used to play the game.

  1. Imports Microsoft.Win32

We’ll now make a registrykey variable.

  1. Dim FF_key As RegistryKey

Now we will make sure the location want it stored in that variable.

  1. FF_key = Registry.LocalMachine.OpenSubKey("\Software\Microsoft\", True)

Now to read in the Keys that are already saved by the game. In this part I called a few keys that I wanted information from, so in order to do that I first declare my variables:

  1. Dim key_windowed_mode As String
  2. Dim key_res_1 As String
  3. Dim key_res_2 As String
  4. Dim key_3D_res_1 As String
  5. Dim key_3D_res_2 As String
  6. Dim key_texture_compress As String
  7. Dim key_on_screen_map As String
  8. key_res_1 = FF_key.GetValue("0001")
  9. key_res_2 = FF_key.GetValue("0002")
  10. key_3D_res_1 = FF_key.GetValue("0003")
  11. key_3D_res_2 = FF_key.GetValue("0004")
  12. key_texture_compress = FF_key.GetValue("0018")
  13. key_on_screen_map = FF_key.GetValue("0019")

The (“numbers”) is the key name which holds the information that I wanted.
Now when it comes to writing it’s just as easy:

  1. FF_key.SetValue("0034", 1, RegistryValueKind.DWord

Valuekind.dword is just the datatype, you don’t always needs to do this but for this to work for me in this case I had to.

Leave a Reply

Your email address will not be published. Required fields are marked *