|
-
Jul 9th, 2009, 02:48 AM
#1
Thread Starter
Member
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...
Last edited by batserra; Jul 9th, 2009 at 03:09 AM.
-
Jul 9th, 2009, 03:38 AM
#2
Lively Member
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.
-
Jul 9th, 2009, 03:40 AM
#3
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
Rate People That Helped You
Mark Thread Resolved When Resolved
-
Jul 9th, 2009, 05:08 AM
#4
Thread Starter
Member
Re: Problems accesing the register
thanks a lot ,it's working !!!!
again the best vb.net forum that exists
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|