Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5982001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:01:28+00:00 2026-05-22T22:01:28+00:00

I have created the following registry key (copied through regedit): HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\test I would like

  • 0

I have created the following registry key (copied through regedit):

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\test

I would like to now delete this registry key, and so… I have been using the following code and am running into a small error.

RegistryKey regKey;

    string regPath_Key = @"Software\Microsoft\Windows\CurrentVersion\test";

    regKey = Registry.CurrentUser.OpenSubKey(regPath_Key, true);

    if(regKey != null)   // Always returns null, even though the key does exist.
    {
        Registry.CurrentUser.DeleteSubKey(regPath_Key, true);
    }

The issue I am having is that the line if(regKey != null) always returns null! I have gone back and checked that the key does in fact exist multiple times – but still the same result. I am going to assume my code has issues somewhere?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:01:29+00:00Added an answer on May 22, 2026 at 10:01 pm

    You should not include HKEY_CURRENT_USER in the string you pass to Registry.CurrentUser.OpenSubKey(). Instead use

    string regPath_Key = @"Software\Microsoft\Windows\CurrentVersion\test";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am Creating the Registry Key using following code: LPCTSTR lpNDS= TEXT(SOFTWARE\\myKEY); if(OK==ERROR_SUCCESS) {
I have created following activity package com.ali.test; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import
I have created the following stored procedure.. CREATE PROCEDURE [dbo].[UDSPRBHPRIMBUSTYPESTARTUP] ( @CODE CHAR(5) ,
I have created UITableCellView class called NoteCell . The header defines the following: #import
I have the following database table created thus: CREATE TABLE AUCTIONS ( ARTICLE_NO VARCHAR(20),
I have created following stored user defined it gets executed successfully. CREATE FUNCTION spherical_distance1(@a
i have created the following function to show and address in JS: function showMapForm(idDiv,
I have created the following class implementing a ListSelectionListener interface. This class should listen
I need to connect to a remote MySQL database and have created the following
I have a vbscript that creates a registry entry on a Windows Server 2003

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.