|
-
Aug 9th, 2002, 10:25 AM
#1
Thread Starter
Junior Member
Accessing Registry Settings
I 'm trying to Create and Set values in the registry. How do I set permissions so that my program has access to do this in Vb.Net?
-
Aug 9th, 2002, 10:34 AM
#2
hmm i didnt know you need to set any permissions!! Have you actually tried writing to the reg?
-
Aug 9th, 2002, 01:16 PM
#3
Frenzied Member
He might need to if the program is running of Win2000 or WinXP.
Dont gain the world and lose your soul
-
Aug 9th, 2002, 04:57 PM
#4
PowerPoster
I think you can only write to the CurrentUser keys....not sure.
-
Aug 10th, 2002, 02:07 AM
#5
Addicted Member
If you are talking about computer permissions then you must have administrative rights but if your talking about your program being able to write to the registry it is just a True or Flase.
For example this is how I wrote to the registry in my last program.
Dim GetRegKey As RegistryKey
GetRegKey = Registry.LocalMachine.OpenSubKey("Software\Folder\Subfolder", False ) 'change to true if you need to write
Integer1 = CInt(GetRegKey.GetValue("Intvalue", ""))
String1 = Convert.ToString(GetRegKey.GetValue("Strvalue", ""))
GetRegKey.Close()
If you are writing the the registry then instead of saying someting = CInt.... then just put
PutRegKey.SetValue("Value", "1") or PutRegKey.SetValue("Name","my name is not fred")
-
Dec 19th, 2002, 05:28 PM
#6
Hyperactive Member
Hey,
When I type
I don't get the keyword RegistryKey drop down in the autocomplete. Do I need to add a reference to it?
"The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.
Windows & Web Developer
Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
Sutherland Shire, Sydney Australia
www.stingrae.com.au
Developer of Arnold - Gym & Martial Arts Database Management System
www.gymdatabase.com.au
-
Dec 19th, 2002, 05:52 PM
#7
PowerPoster
Yes, it is in the Microsoft namespace.
-
Dec 19th, 2002, 05:57 PM
#8
Hyperactive Member
uh-huh!!!
found it!
Code:
Dim RegKey As Microsoft.Win32.RegistryKey
thanks
"The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.
Windows & Web Developer
Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
Sutherland Shire, Sydney Australia
www.stingrae.com.au
Developer of Arnold - Gym & Martial Arts Database Management System
www.gymdatabase.com.au
-
Dec 19th, 2002, 06:34 PM
#9
Hyperactive Member
hmmm.... now i keep getting this message:
n unhandled exception of type 'System.NullReferenceException' occurred in App01.exe
any ideas?
"The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.
Windows & Web Developer
Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
Sutherland Shire, Sydney Australia
www.stingrae.com.au
Developer of Arnold - Gym & Martial Arts Database Management System
www.gymdatabase.com.au
-
Dec 19th, 2002, 06:36 PM
#10
Hyperactive Member
i went into the registry and created the key manually. is there a function that says "IfExists"?
"The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.
Windows & Web Developer
Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
Sutherland Shire, Sydney Australia
www.stingrae.com.au
Developer of Arnold - Gym & Martial Arts Database Management System
www.gymdatabase.com.au
-
Dec 19th, 2002, 07:55 PM
#11
Fanatic Member
Strangely enough, a couple of articles down in the forum list, there is:
"Test if registry key exists"
http://www.vbforums.com/showthread.p...hreadid=220853
-
Dec 19th, 2002, 07:59 PM
#12
Hyperactive Member
sorry. hungover ..... again
"The passion lives to keep your faith, though all are different, all are great" ... Michael Hutchence 1960-1997.
Windows & Web Developer
Specialising in Visual Basic .Net & Client Server Programming & Client/Customer Relations Databases
Sutherland Shire, Sydney Australia
www.stingrae.com.au
Developer of Arnold - Gym & Martial Arts Database Management System
www.gymdatabase.com.au
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
|