How to

write a windows registry key

Published: 13. December 2008 | Updated: 26. October 2011
License: Microsoft Public License (MS-PL)
Categories: Windows » Registry
Tags: C# Windows
Was this snippet helpful for you? YESYES / NONO

Import namespace

using Microsoft.Win32;

Code

// get key
RegistryKey key = null;
key = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\MyApplication\Settings");

// set value
key.SetValue("FormSize", new Size(500, 400));

// close
key.Close();
Send us feedback about this snippet »



Related Snippets: