Sunday, December 28, 2014

The Windows RegistryKey in C#

10:03 AM - By azeheruddin khan 0

Here i have demonstrates how to retrieve the subkeys of key, and display their names to the listbox.



Example program for Registry.CurrentUser


RegistryKey regKey = Microsoft.Win32.Registry.CurrentUser;
String[] names = regKey.GetSubKeyNames();


Example program for Registry.LocalMachine


RegistryKey regKey = Microsoft.Win32.Registry.LocalMachine;
String[] names = regKey.GetSubKeyNames();



Example program for Registry.ClassesRoot


RegistryKey regKey = Microsoft.Win32.Registry.ClassesRoot;
String[] names = regKey.GetSubKeyNames();


Example program for Registry.CurrentConfig


RegistryKey regKey = Microsoft.Win32.Registry.CurrentConfig;
String[] names = regKey.GetSubKeyNames();

Example program for Registry.PerformanceData

RegistryKey regKey = Microsoft.Win32.Registry.PerformanceData;
String[] names = regKey.GetSubKeyNames();





Example program for Registry.DynaData

The operating system does not support dynamic data. use the PerformanceData registry key instead.

Example program for Registry.Users

RegistryKey regKey = Microsoft.Win32.Registry.Users;
String[] names = regKey.GetSubKeyNames();


Example program for Registry.SetValue

Microsoft.Win32.Registry.SetValue(@"HKEY_CURRENT_USER\Software\CompanyName\SoftwareName","Fresher2Programmer", "My blog", RegistryValueKind.String);

Example program for Registry.GetValue

string strGetValue = (string)Microsoft.Win32.Registry.GetValue(@"HKEY_CURRENT_USER\Software\CompanyName\SoftwareName", "Fresher2Programmer", null);







About the Author

I am Azeheruddin Khan having more than 6 year experience in c#, Asp.net and ms sql.My work comprise of medium and enterprise level projects using asp.net and other Microsoft .net technologies. Please feel free to contact me for any queries via posting comments on my blog,i will try to reply as early as possible. Follow me @fresher2programmer
View all posts by admin →

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

adsense

© 2014 Fresher2Programmer. WP Theme-junkie converted by Bloggertheme9
Powered by Blogger.
back to top