Mega Code Archive

 
Categories / C# / Windows
 

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"));     } }