Write a Text and DWord Value to the Registry : Registry : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » Registry »

 

Write a Text and DWord Value to the Registry








    


using System;
using Microsoft.Win32;

class Class1 {
    static void Main(string[] args) {
        RegistryKey RegKeyWrite = Registry.CurrentUser;
        RegKeyWrite = RegKeyWrite.CreateSubKey("Software\\CSHARP\\WriteRegistryValue");
        RegKeyWrite.SetValue("Success", "TRUE");
        RegKeyWrite.SetValue("AttemptNumber", 1);
        RegKeyWrite.Close();

        RegistryKey RegKeyRead = Registry.CurrentUser;
        RegKeyRead = RegKeyRead.OpenSubKey("Software\\CSHARP\\WriteRegistryValue");
        Object regSuccessful = RegKeyRead.GetValue("Success");
        Object regAttemptNumber = RegKeyRead.GetValue("AttemptNumber");
        RegKeyRead.Close();

        Console.WriteLine(regSuccessful);
      
    }
}
           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» Registry