Writing into Windows Registry using C#

This C# code snippet writes a key to the Windows Registry.

WARNING: Do NOT play with the Registry. If you do not know what you are doing, you can cause any number of costly problems. Use this code at your own risk.

using Microsoft.Win32;

RegistryKey masterKey = Registry.LocalMachine.CreateSubKey
if (masterKey == null)
   Console.WriteLine ("Null Masterkey!");
      masterKey.SetValue ("MyKey", "MyValue");
   catch (Exception ex)
      Console.WriteLine (ex.Message);

That's It.

25 responses to this post.

  1. Admiring the persistence you put into your blog and in depth information you provide. It’s good to come across a blog every once in a while that isn’t the same unwanted rehashed information. Wonderful read! I’ve saved your site and I’m adding your RSS feeds to my Google account.

  2. Had a lens earn $1,000 in a very single month

  3. It is pretty important that your company name will need to be the domain name and if you will not know SEO learn it and even though learning simply outsouece it to others who are very good at it.Odesk is genuinely superior for this.

  4. Welcome to Studio Plazma, Visit us on:

  5. Honest untamed energy with purpose. Close to your bone. Rip it up. Find it irresistible!

  6. You should really control the commentary on this page

  7. Im getting a browser error, is anyone else?

  8. How come you dont have your site viewable in mobile format? Can not see anything in my iPhone.

  9. Brilliant, thank you, I will visit again later!

  10. Wanted to drop a remark and let you know your Rss feed isnt working today. I tried adding it to my Google reader account but got absolutely nothing.

  11. I was wondering if you ever considered changing the page layout of your website? It is well written; I really like what you have got to say. But maybe you can include a little more in the way of written content so people could connect with it better. Youve got an awful lot of wording for only having one or two pictures. Maybe you could space it out better?

  12. If you dont mind, where do you host your webpage? I am hunting for a good host and your webpage seams to be extremely fast and up just about all the time

  13. The majority of of the opinions on this site dont make sense.

  14. When are you going to post again? You really inform me!

  15. It appears to me that this site doesnt download on a Motorola Droid. Are other folks getting the exact same issue? I enjoy this site and dont want to have to miss it any time Im gone from my computer.

  16. Nearly all of the remarks on this website dont make sense.

  17. I have got 1 suggestion for your site. It seems like at this time there are a number of cascading stylesheet problems while opening a selection of web pages within google chrome and safari. It is working fine in internet explorer. Perhaps you can double check that.

  18. Awesome post ! Thank you for, commenting on my blog page dude! Ill email you some time! I didnt realise that.

  19. If you dont mind, where do you host your web page? I am hunting for a good web host and your weblog seams to be quick and up almost all the time

  20. Jesus Christ theres lots of spammy feedback on this page. Have you at any time thought about attempting to get rid of them or installing a wordpress plugin?

  21. Have you given any kind of consideration at all with converting your current webpage in to French? I know a couple of of translaters here which might help you do it for free if you want to make contact with me.

  22. Re: The person who created the remark that this was a good website truly needs to get their brain examined.

  23. Even though I truly like this post, I believe there was an punctuational error shut to the finish of the 3rd sentence.

  24. Hey, I just hopped over to your webpage using StumbleUpon. Not somthing I might typically browse, but I liked your thoughts none the less. Thank you for making something worthy of reading.

  25. Between me and my husband we’ve owned more MP3 players over the years than I can count, including Sansas, iRivers, iPods (classic & touch), the Ibiza Rhapsody, etc. But, the last few years I’ve settled down to one line of players. London Olympics Medal Tally

Comments are closed.

%d bloggers like this: