Solved

Update registry settings using .NET

Posted on 2004-09-21
10
1,554 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

770 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