Solved

Set a Dword Value Key To Registry C#

Posted on 2011-02-24
3
3,647 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
ID: 34972573
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
ID: 34981317
0
 

Author Closing Comment

by:fancyfanta
ID: 34984380
RegistryValueKind::DWord has small syntax error.

=> RegistryValueKind.DWord
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
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.

786 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