What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Visual Basic .NET: Deleting a Registry Value failed

Visual Basic .NET: Deleting a Registry Value failed
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Visual Basic .NET: Deleting a Registry Value failed
I don't have much (read: as good as no) experience with VB.NET either, but here are my thoughts (taken from the MSDN library):

quote:
Originally posted by ryxdp
code:
My.Computer.Registry.CurrentUser.DeleteValue("HKEY_CURRENT_USER\Control Panel\Desktop\testingval\")

for starters, is My.Computer.Registry.CurrentUser defined as a proper RegistryKey object?

Second, if "testingval" is a value, you should not add the last backslash (you shouldn't even add it if it is a subkey, I think).

Second, you need to open that key first before you can delelete the value "testingval"...

See DeleteValue

eg:

' Creates a subkey under HKCU named "Test9999"
Dim test9999 As RegistryKey = Registry.CurrentUser.CreateSubKey("Test9999")
' Thus not:
' Registry.CurrentUser.CreateSubKey("HKEY_CURRENT_USER\Test9999\") I think


Dim testSettings As RegistryKey = test9999.CreateSubKey("TestSettings")
testSettings.SetValue("ID", 123)
testSettings.Close()

' Deletes the newly created "id" value under the "HKCU\Test9999\TestSettings\" key. Assuming test9999 is a proper defined RegistryKey object.
testSettings = test9999.OpenSubKey("TestSettings", True)
testSettings.DeleteValue("id")
testSettings.Close()

Full example code is given on the MSDN library::RegistryKey Class

This post was edited on 07-12-2008 at 03:13 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-12-2008 02:55 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Visual Basic .NET: Deleting a Registry Value failed - by ryxdp on 07-12-2008 at 08:21 AM
RE: Visual Basic .NET: Deleting a Registry Value failed - by Matti on 07-12-2008 at 10:09 AM
RE: RE: Visual Basic .NET: Deleting a Registry Value failed - by ryxdp on 07-12-2008 at 10:16 AM
RE: Visual Basic .NET: Deleting a Registry Value failed - by CookieRevised on 07-12-2008 at 02:55 PM
RE: Visual Basic .NET: Deleting a Registry Value failed - by ryxdp on 07-13-2008 at 12:26 AM
RE: RE: Visual Basic .NET: Deleting a Registry Value failed - by pollolibredegrasa on 07-13-2008 at 01:48 AM
RE: Visual Basic .NET: Deleting a Registry Value failed - by ryxdp on 07-13-2008 at 05:11 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On