TechSapphire Sunday, 2024-05-19, 4:02 AM
Site menu
Login form
News
Play Games
  • Deep Freeze
  • Ice Slide
  • Gyroball
  • Fat Fish
  • Bush Royal Rampage
  • Editing Registry using .net

    For editing registry using .net you need to import microsot.win32 namespace. The Microsoft.Win32 namespace provides two types of classes: those that handle events raised by the operating system and those that manipulate the system registry.

    In editing registry we have to do following operations. Those are:

    Creating Subkey:

    First you have to import Microsoft.win32 namespace. Then declare a variable of type registry key. Do as guided in code.

    VB.Net code

    Imports Microsoft.Win32

    Public Class Pathcreater

    Private sub subkey_creator()

            Dim regKey1 As RegistryKey

            Dim strpath as string

          ‘let we have to create path under localmachine. Let it be hello_world_key under software.

           Strpath=”Software\hello_world_key”

                regKey1 = Registry.LocalMachine

    regKey1.CreateSubKey(strpath)

                regKey1.Close()

    End Sub

    End Class

    Creating Value:

    For creating value first you need to open the subkey then you could create a value.

    VB.Net

    Imports Microsoft.win32

    Public class value_creator

    Private sub value_work()

            Dim regkey As RegistryKey

             regkey = Registry.CurrentUser.OpenSubKey("software\hello_world_key", True)

    ‘ valuename like nodrives, etc. Value like 1 or 0, etc.

                regkey.SetValue("valuename", value)

                regkey.Close()

    End sub

    End Class

     

    The following code example shows how to create a subkey under HKEY_CURRENT_USER, manipulate its contents, and then delete the subkey.

    (This example is edited copy of example by Microsoft MSDN)


    Example In c#

    Example in Vb.Net


    System.Security.Permissions Namespace

    The System.Security.Permissions namespace defines classes that control access to operations and resources based on policy.

    (For more information go to Microsoft MSDN)


    Categories
    Programming [27]
    Tips for programming
    Security [2]
    Security Tips
    Google [1]
    Use google faster then ever you use
    Project [14]
    HTML [2]
    Electronics [0]
    Data Structure [0]
    Database [16]
    SQL SERVER
    SSRS [1]
    Sql Server Reporting Services
    Copyright MyCorp © 2024