10-10-2010, 06:11 PM
(This post was last modified: 10-12-2010, 06:52 AM by Resistance.)
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:
Now for the coding.
As usual we must import ms.win32
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".
Lets see if we can make it work.
It works!
Now for the second button a.k.a. Edit the value, in vb known as "set".
Now the results should be like this:
Then after setting the value to HFrox,
And that is how you are able to read and edit the value of a registry key.
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:
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".
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!
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:
Then after setting the value to HFrox,
And that is how you are able to read and edit the value of a registry key.