Click here to Skip to main content
15,894,630 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I created a function:

VB
Public Sub CreateRegistrySubKey(ByVal iSubKeyName As String)
    Dim regKey As RegistryKey
    regKey = My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE", True)
    regKey.CreateSubKey(iSubKeyName)
    regKey.Close()
End Sub


Of course, the module has
"Imports Microsoft.Win32" in the header.

In the executable portion, I call this as:

CreateRegistrySubKey("MyNew Application")


I can't seem to get this to work correctly. It doesn't create the new subkey in the registry.

What am I doing wrong?
Posted

1 solution

If your executable is 32 bits, it may fall into HKLM\Software\Wow6432Node.
 
Share this answer
 
Comments
KevinBrady57 6-Jan-14 12:03pm    
That's where it was. Thanks
phil.o 6-Jan-14 12:45pm    
You're welcome.
KevinBrady57 6-Jan-14 13:12pm    
Is there a way to "force" the subkey to be created off the root (i.e. "Software)" instead of the Wow6432Node?
KevinBrady57 6-Jan-14 13:18pm    
Never mind. I figured it out.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900