Search code examples
vb.netregistry

save and load value from registry in vb.net


I have an application where the user select configuration, I need to write to function one to save the configuration when the application is closed and other load the configuration when the application is loaded, i need to use registry would you able to help me by giving me 2 small example how to save and to load from the registry. thank you Jp


Solution

  • The "My" Class in VB contains almost everything you need. To read data:

    My.Computer.Registry.LocalMachine.GetValue("mykey")
    

    To write data:

    My.Computer.Registry.LocalMachine.SetValue("mykey", "myvalue")
    

    Hope it helps.