Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[TuToRiAl] How to Get/Edit the value of a key in the Registry (Part 2)
#1
Hello everyone, your tutorial guru, legitwaste here...

Today we are going to learn how to edit and read a registry key, extremely simple, unless you want to make it complicated for yourself lol.


WARNING: You Must Be Running the Application as an Administrator if you are using Windows Vista/7, XP Users need to use this technique
only when accessing the LOCAL_MACHINE.


Now add 2 buttons and 2 textboxes to your form so that they look like this:
[Image: 29dfpqq.png]

Now for the coding.

As usual we must import ms.win32


Code:
Imports Microsoft.Win32
Public Class Form1

Next we will edit the code of "read a value" a.k.a. Button1.

We are trying to find and then edit the value of the string, Test. As you can see the value is "SupportForumsRocks".


[Image: 2vvqbuh.png]

Lets see if we can make it work.

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        TextBox1.Text = Registry.GetValue("HKEY_CURRENT_USER\Environment\", "Testing", "")
    End Sub

It works!

[Image: 2jf14b4.png]

Now for the second button a.k.a. Edit the value, in vb known as "set".

Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Registry.SetValue("HKEY_CURRENT_USER\Environment\", "Testing", TextBox2.Text, RegistryValueKind.String)
    End Sub

Now the results should be like this:

[Image: 23sdp5l.png]

Then after setting the value to HFrox,

[Image: 2ceop75.png]

[Image: rmv3hy.png]

And that is how you are able to read and edit the value of a registry key.
[Image: t5BWm.png]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  VB.Net Make a Real AntiVirus (AV) - Part 1 goranpilkic 27 28,508 08-25-2014, 12:43 AM
Last Post: dark_move
  Encrypt String using x509Certificate private Key wih RSA jeffstan 0 2,326 01-26-2014, 04:18 PM
Last Post: jeffstan
  [TuToRiAl] How to make Offline (No Internet) Captcha (Human Confirmation) [TuToRiAl] Resistance 24 10,996 08-30-2012, 10:14 PM
Last Post: Resistance
  [video]Make a theme in three part HF~Legend 1 889 12-07-2011, 08:40 AM
Last Post: thespragg
  The Basics of VB [Part 2] SomeWhiteGuy? 5 1,993 10-25-2011, 10:47 AM
Last Post: SomeWhiteGuy?

Forum Jump:


Users browsing this thread: 1 Guest(s)