C#
  Home arrow C# arrow Page 2 - Working with Windows Registry in C#
Iron Speed
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
IBM Rational Software Development Conference
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C#

Working with Windows Registry in C#
By: Barzan "Tony" Antal
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2008-03-05

    Table of Contents:
  • Working with Windows Registry in C#
  • The Basics
  • Let's Do It!
  • More Techniques
  • Final Words

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    Iron Speed
     
    ADVERTISEMENT

    Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    Working with Windows Registry in C# - The Basics
    (Page 2 of 5 )

    Before we begin, I'd like to point something out: during this tutorial, I will assume that you, the reader, are already familiar with the Windows registry and know most of its "inner workings." Going over details to describe its structure is beyond the scope of this article. Therefore, we are just going to remind ourselves of its structure in a nutshell.

    The Windows registry contains the following two elements: keys and values. Each of the keys can also have values and subkeys. Keys act like folders (branches) from an analogical perspective, while values are name-data pairs that actually contain data on their data part. The entire registry is split into various sections that are called hives.

    Let's refresh our memory, in case we've forgotten their full or abbreviated names:

    Ø        HKCR    --    HKEY_CLASSES_ROOT

    Ø        HKCU    --    HKEY_CURRENT_USER

    Ø        HKLM    --    HKEY_LOCAL_MACHINE

    Ø        HKU      --    HKEY_USERS

    Ø        HKCC    --    HKEY_CURRENT_CONFIG

    The time couldn't be better for you to launch the Windows Registry Editor (regedit.exe or regedt32.exe) and go over it. Due to the nature of this tutorial, we cannot move on before I suggest that you back up your registry. Once this step is done and you are familiar with its structure, you should be prepared.

    It would be very useful for you to create a test key with test values somewhere deep in the hierarchy of the registry. For the purpose of this article, I have created the following subkey: "HKCUSoftwareTutorial" and there I have created a few string values, such as "DS" - "Developer Shed" and "DA" - "Dev Articles."

    That's all great. I am sure you have guessed that we are going to work with these values throughout this article. So once you have created the appropriate subkey and string values and your registry is backed up (but we won't do any harm anyway) then please head on to the next page.

    More C# Articles
    More By Barzan "Tony" Antal


       · Thanks for reading this tutorial. I hope you've found it informative and education....
       · Clean, crisp to the point introductory article, keep it up.Thanks
     

    C# ARTICLES

    - Value Types and Reference Types
    - Defining Member and Type Visibility
    - Managing Files in C#
    - Working with Windows Registry in C#
    - Lossless Image Resizing in C#
    - Lossless Image Converting in C#
    - Creating an RSS Feed with ASP.Net Written in...
    - Polymorphism in C#
    - Inheritance in C#
    - C# Events Explained
    - C# Delegates Explained
    - C# StreamReader and StreamWriter Explained
    - C# FileStream Explained
    - A Look at C# File and FileInfo Classes
    - A Look at C# Directory and DirectoryInfo Cla...




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway