Solved

Update registry settings using .NET

Posted on 2004-09-21
10
1,553 Views
Last Modified: 2008-03-17
Hello.

In Internet explorer, if you go
Tools > Internet Settings > Connections (tab) > LAN settings > 

Theres is a checkbox at the top labelled:
"Automatically detect settings"

I need to write an app that will update this value in the registry. The key associated with it can be found at
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections, DefaultConnectionSettings

How do I update binary values using .NET, for true and false values of the checkbox.

Any help would be appreciated. Thanks
0
Comment
Question by:bLUE
  • 4
  • 3
10 Comments
 
LVL 8

Expert Comment

by:bramsquad
ID: 12113713
Dim key As Microsoft.Win32.RegistryKey
key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\DefaultConnectionSettings")

key.SetValue("DefaultConnectionSettings", ckBool.Value)

~b
0
 
LVL 1

Author Comment

by:bLUE
ID: 12113754
Hi. Will that actully work since, DefaultConnectionSettings value holds a lot of other settings too?
0
 
LVL 8

Expert Comment

by:bramsquad
ID: 12113784
wait...

what do mean "update binary values...for true and false values of the checkbox"?

and after reading it closer, my code is wront, it creates the key...

0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 1

Author Comment

by:bLUE
ID: 12113851
The key already exists. DefaultConnectionSettings is an existing binary key that contains data for IE connections. I want to update one of those values in that data pool
0
 
LVL 8

Expert Comment

by:bramsquad
ID: 12114108
if you know which one you want to change then you could use the hex() function to change the data.

so it would be something like this (and you dont even have to create a variable...this is the only piece of code youll need)

Microsoft.Win32.Registry.CurrentUser.SetValue("Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\DefaultConnectionSettings", Hex(123456))

if you need to get the value and then manipulate it, you could GetValue(), make it a string, parse it, change it, concatinate it, and then pass it that way (dont know if itll make that data conversion though)

~b

0
 
LVL 1

Author Comment

by:bLUE
ID: 12114204
yeh i see what you mean, but I dont know which bit of the binary code is specific to that value :/
0
 
LVL 8

Accepted Solution

by:
bramsquad earned 125 total points
ID: 12114672
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now