[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1563
  • Last Modified:

Update registry settings using .NET

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
bLUE
Asked:
bLUE
  • 4
  • 3
1 Solution
 
bramsquadCommented:
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
 
bLUEAuthor Commented:
Hi. Will that actully work since, DefaultConnectionSettings value holds a lot of other settings too?
0
 
bramsquadCommented:
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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
bLUEAuthor Commented:
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
 
bramsquadCommented:
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
 
bLUEAuthor Commented:
yeh i see what you mean, but I dont know which bit of the binary code is specific to that value :/
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now