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:
pollolibredegrasa
Full Member
***

Avatar
formerly fatfreechicken

Posts: 483
Reputation: 34
35 / Male / Flag
Joined: May 2005
RE: RE: Visual Basic .NET: Deleting a Registry Value failed
This code works for me, and should get you started...
code:
Dim regkey As RegistryKey = My.Computer.Registry.CurrentUser.OpenSubKey("Control Panel\Desktop", True)

You can then go on and use stuff like
code:
Dim svalue As String = regkey.GetValue("ScreenSaveActive")
regkey.DeleteValue("testingval")

etc...

A couple of other things I've noticed.

First,
code:
My.Computer.Registry.CurrentUser.OpenSubKey("HKEY_CURRENT_USER\Control Panel\Desktop", True)
Here you've already opened HKEY_CURRENT_USER, by stating it again you make it look for a subkey called HKEY_CURRENT_USER, which is one reason this line probably doesn't work.


Secondly, you used 2 If statements in a row:
code:
If <snip>
            My.Computer.Registry.SetValue("HKEY_Current_User\Control Panel\Desktop\", "ScreenSaveActive", "0")
End If

If My.Computer.Registry.GetValue("HKEY_Current_User\Control Panel\Desktop\", "ScreenSaveActive", "Unknown") = "0" Then
If your code worked and changed the correct values, your first If statement would change a value to 0. Immediately after that your second If statement would also be executed and change it back to 1 (because the value is now 0). You should change to an If..Else statement or add an Exit Sub in your Ifs to avoid this.

Hope this helps :)

This post was edited on 07-13-2008 at 01:54 AM by pollolibredegrasa.
;p

[Image: chickennana.gif] Vaccy is my thin twin! [Image: chickennana.gif]
07-13-2008 01:48 AM
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