Get registry value from LocalMachine key : Registry « Windows « C# / C Sharp






Get registry value from LocalMachine key


using System;
using System.Windows.Forms;
using Microsoft.Win32;

public class FormSettingStore {

    public static void Main(){
        RegistryKey key = Registry.LocalMachine.CreateSubKey("KeyName");

        key.SetValue("Height", "100");
        key.SetValue("Width", "100");
        key.SetValue("Left", "100");
        key.SetValue("Top", "100");

        Console.WriteLine((int)key.GetValue("Height", "150"));
        Console.WriteLine((int)key.GetValue("Width",  "150"));
        Console.WriteLine((int)key.GetValue("Left",  "150"));
        Console.WriteLine((int)key.GetValue("Top",  "150"));
    }
}    
           
       








Related examples in the same category

1.Save value to registery
2.Read value from registry
3.Retrieve the CPU Type and Speed from the Registry
4.Write a Text and DWord Value to the Registry
5.Enumerating Registry Keys