Problems accesing the register
hi everyone,
I have problems accesing the windows register, i want to create some keys (if there isn't) with this format:
software\company\parameters
|
|___Variable1 Valor1
|___Variable2 Valor2
|___Variable3 Valor3
I trayed with:
dim v1 as string
Dim key As RegistryKey = Registry.LocalMachine.CreateSubKey("Software\Company\Parameters")
key.CreateSubKey("Variable1")
v1 = key.GetValue("Variable1").ToString
if v1 == Null then v1="Valor1"
But doesn't work, any idea?
As ever many thanks...
Re: Problems accesing the register
Why are you using:
Code:
Registry.LocalMachine.CreateSubKey("Software\Company\Parameters")
? The way I've always done it is simply along the lines of:
Code:
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", _
Application.ProductName, _
Application.ExecutablePath)
Obviously that's for booting programs on startup but you get the point. If there's some reason you've done it like you have just ignore this post but otherwise, hope I helped. :)
Re: Problems accesing the register
Do something like this.
VB.NET Code:
Dim v1 As String = "Valor1"
Dim key As RegistryKey = Registry.LocalMachine.CreateSubKey("Software\Company\Parameters")
If key.GetValue("Variable1") Is Nothing Then
key.SetValue("Variable1", v1)
End If
Re: Problems accesing the register
thanks a lot ,it's working !!!!
again the best vb.net forum that exists