C# and Windows Registry Basic Tutorial

Dubmood

Member
May 20, 2011
760
44
0
Old School
C# and Windows Registry Basic Tutorial


I have commented out all steps. I guess you can go through it.
if you got any questions regarding these codes. don't hesitate to PM me.


Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;

namespace WindowsRegistry
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //Registry.CurrentUser.CreateSubKey(@”EK\Dubmood”);
            //Create the Sub Key in the Registry
            //Registry.CurrentUser.DeleteSubKeyTree("EK"); //Optional
            Registry.CurrentUser.DeleteSubKey(@"EK\Dubmood");

            //string reg_currentuser = Registry.CurrentUser.ToString(); //get the path name of the currentuser
            //so you don't need to mention that again and again
            //Registry.SetValue(reg_currentuser+@"EK\Dubmood","Dubmood",DateTime.Today);
            //MessageBox.Show(Convert.ToString(Registry.GetValue(reg_currentuser + @"EK\Dubmood", "Dubmood", "Unable to Find anything"))); //get the value from the Dubmood key

            //get all sub keys under the hive
            //string[] subkeys = new string[Registry.CurrentUser.GetSubKeyNames().Length];
            //subkeys = Registry.CurrentUser.GetSubKeyNames();

            //foreach (string subkey in subkeys)
            //{
            //    treeView1.Nodes.Add(subkey);
            //}
            
            //get all sub keys under the specific subkey
            //string[] regsubkeys = new string[Registry.CurrentUser.OpenSubKey(@"EK\").GetSubKeyNames().Length];
            //regsubkeys = Registry.CurrentUser.OpenSubKey(@"EK\").GetSubKeyNames();

            //foreach (string subkey in regsubkeys)
            //{
                //treeView1.Nodes.Add(subkey);
            //}

            //get all subkeys and their subkeys and list them in the tree view
        }
    }
}

Dubmood
 

Dubmood

Member
May 20, 2011
760
44
0
Old School
Macho meken monawada karanne, podi wistharayak dapanko.

Windows registry ගැන මචන් මේක, මම comment කරලා තියෙන්නේ steps ඔක්කොම වගේ
registry access
create new registry
read from registry
I have mentioned most of things. but only basics.
 

♥-Aurora-♥

Well-known member
  • Jun 5, 2010
    4,309
    942
    113
    :cool: එලකිරි! පහු ගිය දවස් වල මාත් මේ ගැන හෙව්වා. ඒත් ඕන වැඩේ කරන්න බැරි උනා :(
    ආයෙ ඕනෙ උනොත් මේකෙන් ගන්නම් :)
    රෙප්++ ~♥~
     

    Dubmood

    Member
    May 20, 2011
    760
    44
    0
    Old School
    ♥-Aurora-♥;10215723 said:
    :cool: එලකිරි! පහු ගිය දවස් වල මාත් මේ ගැන හෙව්වා. ඒත් ඕන වැඩේ කරන්න බැරි උනා :(
    ආයෙ ඕනෙ උනොත් මේකෙන් ගන්නම් :)
    රෙප්++ ~♥~

    විස්තර ඕනේ නම් කියන්න මේ ගැන, මම දෙන්නම්
    Thanks for the comment.
     

    ♥-Aurora-♥

    Well-known member
  • Jun 5, 2010
    4,309
    942
    113
    විස්තර ඕනේ නම් කියන්න මේ ගැන, මම දෙන්නම්
    Thanks for the comment.

    11.gif