Solved

Set a Dword Value Key To Registry C#

Posted on 2011-02-24
3
3,461 Views
Last Modified: 2013-12-17
Hi,
I want to change or create a DWORD(reg_dword) key to Registry.

            RegistryKey keyx = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\myapplication", true);
            {
                keyx.SetValue("EnablePORT", "FALSE");
                keyx.Flush();
            }

Open in new window

This code It creates reg_sz. I want to create reg_dword
Please help.

0
Comment
Question by:fancyfanta
3 Comments
 
LVL 16

Accepted Solution

by:
sjklein42 earned 500 total points
Comment Utility
See this

http://msdn.microsoft.com/en-us/library/microsoft.win32.registryvaluekind.aspx#Y638

            RegistryKey keyx = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\myapplication", true);
            {
                keyx.SetValue("EnablePORT", 0, RegistryValueKind::DWord );
                keyx.Flush();
            }

Open in new window

0
 
LVL 13

Expert Comment

by:agarwalrahul
Comment Utility
0
 

Author Closing Comment

by:fancyfanta
Comment Utility
RegistryValueKind::DWord has small syntax error.

=> RegistryValueKind.DWord
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

771 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

9 Experts available now in Live!

Get 1:1 Help Now