views:

74

answers:

1

How do i read, write and delete a registry using VB 2005/2008.
Please give your explanation to your answer. I am really a registry noob...
Thanks. I can't read any programming language other than vb.

+1  A: 

Here is your starting point. It is actually pretty easy stuff, but let me know if you need any help translating the C# code into VB.

http://www.csharphelp.com/archives2/archive430.html

Open Subkey

Dim OurKey = Registry.Users
OurKey = OurKey.OpenSubKey(".DEFAULT",true)

DeleteSubKey() / CreateSubKey() & DeleteSubKeyTree()

Dim OurKey = Registry.Users ' Create OurKey set to HKEY_USERS
OurKey = OurKey.OpenSubKey(".DEFAULT",true) ' Set it to HKEY_USERS\.DEFUALT
OurKey.CreateSubKey("OurSubKey") ' Create the key HKEY_USERS\.DEAFULT\OurSubKey
OurKey.CreateSubKey("OurSubKey\Subkey") ' Create a sub key HKEY_USERS\.DEFAULT\OurSubKey\Subkey
OurKey.DeleteSubKey("OurSubKey\SubKey") ' Delete the subkey name "subkey"
OurKey.DeleteSubKeyTree("OurSubKey") ' Delete the whole subkey and any subkeys below it

GetSubKeyNames()

'The first example shows it using a foreach loop to display each subkeyname
for each Keyname in OurKey.GetSubKeyNames()
    MessageBox.Show(Keyname)
next
//The second example shows how to tranfer the names into a string array
dim Keynames = OurKey.GetSubKeyNames()
Jonathan Allen
I can't read c#
yihang