Sometimes we need to write to system registry. For ex you can save connectionstring to systen Registry, Software trial information etc. this also helpful when you want to hide information from normal user then its recommended to save information into system registery.
so below is the solution to write into system registery.
in C# example
public static void WriteToRegistry(string keyToWrite,object valueToWrite,string path)
RegistryKey oRegistry = Registry.LocalMachine.CreateSubKey(path);
if(oRegistry != null)
In Vb.Net sample method
Public Shared Sub WriteToRegistry(ByVal keyToWrite As String, ByVal valueToWrite As Object, ByVal path As String)
Dim oRegistry As RegistryKey = Registry.LocalMachine.CreateSubKey(path)
If oRegistry IsNot Nothing Then
Above method is accepting the key and value as an input