473,324 Members | 2,581 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

writing to DefaultGateway registry value

1
I need to change some network settings with my C# program. I wrote the following function:

public void Write_to_reg(string id, string KeyName, string Value)
{
RegistryKey regKeyAppRoot = Registry.CurrentUser.CreateSubKey(strTargetReg + "\\" + id);
try
{
regKeyAppRoot.SetValue(KeyName, Encoding.ASCII.GetBytes(Value));
}
catch (Exception e)
{
MessageBox.Show("Error! Please Try Again. " + e.Message , "Settings Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

I am able to modify the "IPAddress" field, but when I try to modify the "DefaultGateway", and "NameServer" fields I don't get any errors, but the values do not change. What am I doing wrong?

I am actually trying to blank out those 2 fields.

Thanks, Tim
Apr 10 '07 #1
0 779

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Pat Blair | last post by:
Hello. I'm looking for any information I can get about writing values to keys in the Windows registry when the value type is a multi-string (ie. REG_MULTI_SZ). When I get the value of a...
0
by: Pat Blair | last post by:
Sorry to anyone who read this post, but in case it's useful to anyone: Further experiments reveal that while a tuple comes back if you read a multi-line string, you set the value using a list (not...
2
by: Scott Vercuski | last post by:
Everyone, I'm having trouble writing an event to the event log. Here is the chunk of code I currently have. ----------------------------------------------------------------------- Private...
6
by: Bry | last post by:
I'm having problems writing (and reading) boolean data to the registry. // Write a boolean value to the registry // I've not included the obvious bits of code in these samples bool myBool =...
1
by: Shawn | last post by:
i am trying to write a test that would cause a method that writes a registry value name to fail. can anyone tell me if there are any limitations to a registry value name? length? types of...
1
by: Steve Bostedor | last post by:
I'm trying to use the RegistryKey to write a hex number into the registry as a binary type. I know see that in DotNet, the RegistryKey tries to interprate what registry type to create depending...
5
by: UJ | last post by:
I have a system that has five programs that all communicate with each other via Message Queues. Works well. One program is a watchdog that will make sure the others are up and going. Currently I...
0
by: Chris Mullins | last post by:
I have an application that installs some 64-bit binaries for development use in Visual Studio 2005. As such I want them to appear in the .Net References menu when someone attempts to "Add...
1
by: Chris Mullins | last post by:
I need to write to the 32-bit registry, and need to do so from a 64-bit MSI. It never occurred to me that this would be difficult... I have an application that installs some 64-bit binaries for...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.