473,397 Members | 2,056 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

delete a registry value

JR
Hi,

How can I delete a registry value in vb.net

Jan
Nov 21 '05 #1
3 4376
Imports microsoft.win32

Dim oRegKey As RegistryKey
Dim oBaseKey As RegistryKey

oBaseKey = Registry.CurrentUser
oRegKey = oBaseKey.OpenSubKey("Keyname") 'for example ("Software\...")

if not oRegKey is nothing then
oRegKey.DeleteValue("name")
end if

HTH (Ik hoop dat het helpt)
"JR" <XX***@telenet.XXXX> wrote in message
news:r_*********************@phobos.telenet-ops.be...
Hi,

How can I delete a registry value in vb.net

Jan

Nov 21 '05 #2
Jan,

Very easy using this

http://msdn.microsoft.com/library/de...classtopic.asp

I hope this helps?

Cor
"JR" <XX***@telenet.XXXX>
...
Hi,

How can I delete a registry value in vb.net

Jan

Nov 21 '05 #3
JR
I still get the same error

cannot write to the registry

next follows my code

the first 5 lines are for making a new associasion for filetype tbl (my
program's data files) these works fine

than I have a test follow by some test to give permission no error but also
no luck

'-------------------code starts here*-------------------------------

Private Sub mnuAssocieer_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles mnuAssocieer.Click

Dim Reg_ClassRoot As RegistryKey = Registry.ClassesRoot

Dim Reg_CurUser As RegistryKey = Registry.CurrentUser

Dim Reg_Wis As RegistryKey

Dim regPerm1 As RegistryPermission

Const sExplorerDiscription = "WinTabel competitie bestand"

Const sRegistryDiscription = "WinTabel"

Try

Reg_ClassRoot.CreateSubKey(".tbl").SetValue("", sRegistryDiscription)

Reg_ClassRoot.CreateSubKey(sRegistryDiscription).S etValue("",
sExplorerDiscription)

Reg_ClassRoot.CreateSubKey(sRegistryDiscription &
"\DefaultIcon").SetValue("", Application.ExecutablePath & " ,0")

Reg_ClassRoot.CreateSubKey(sRegistryDiscription &
"\shell\open\command").SetValue("", Application.ExecutablePath & " %1")

Reg_Wis =
Reg_CurUser.OpenSubKey("Software\Microsoft\Windows \CurrentVersion\Explorer\FileExts\.tbl")

If Not Reg_Wis Is Nothing Then

the next 3 lines are new

'regPerm1 = New RegistryPermission(RegistryPermissionAccess.AllAcc ess,
"HKEY_CURRENT_USER\Software\Microsoft\Windows\Curr entVersion\Explorer\FileExts\.tbl")

'regPerm1.AddPathList(RegistryPermissionAccess.All Access,
"HKEY_CURRENT_USER\Software\Microsoft\Windows\Curr entVersion\Explorer\FileExts\.tbl")

'regPerm1.SetPathList(RegistryPermissionAccess.All Access,
"HKEY_CURRENT_USER\Software\Microsoft\Windows\Curr entVersion\Explorer\FileExts\.tbl")

Reg_Wis.DeleteValue("Application") 'here is the error

End If

Catch ex As Exception

MsgBox(ex.Message)

End Try

Reg_ClassRoot.Close()

Reg_CurUser.Close()

End Sub 'mnuAssocieer_Click

'-------------------code ends here*-------------------------------
--
Met vriendelijke groeten.
Jan
"Peter Proost" <pp*****@nospam.hotmail.com> schreef in bericht
news:em**************@tk2msftngp13.phx.gbl...
Imports microsoft.win32

Dim oRegKey As RegistryKey
Dim oBaseKey As RegistryKey

oBaseKey = Registry.CurrentUser
oRegKey = oBaseKey.OpenSubKey("Keyname") 'for example ("Software\...")

if not oRegKey is nothing then
oRegKey.DeleteValue("name")
end if

HTH (Ik hoop dat het helpt)
"JR" <XX***@telenet.XXXX> wrote in message
news:r_*********************@phobos.telenet-ops.be...
Hi,

How can I delete a registry value in vb.net

Jan


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: rdavis7408 | last post by:
I have a database that has a form that opens a report using date parameters. I have been using it for six months and last week I began to get the following Error Message: "File sharing lock...
4
by: Kevin L | last post by:
I store some application settings in the registry under HKEY_LOCAL_MACHINE\Software\MyApplication I want to allow full access to this key and subkeys. Currently, I manually change the...
2
by: Robert Rotstein | last post by:
I’m running an ASP.NET web service which dynamically creates a registry key, stores some values in it, then, on a subsequent call to another method in the service, attempts to delete the key. The...
6
by: Just D. | last post by:
All, I made a wrong assumption and my application created a few new web sites on my machine working under WinXPPro. So that I see "Default Web Site" and these wrong sites which I can't delete...
2
by: george | last post by:
How can I delete a datasource once it has been created in vs.net 2005? --GH
0
by: yxq | last post by:
Hello, I want to know whether current user has the permission to delete a Registry key(test) in .NET 2.0. Sometimes , my code is not right. ...
3
by: Peri | last post by:
I can delete RCan't delete Registry.LocalMachine subkeyegistry.LocalMachine subkey using regedit. But not using code: RegistryKey eurotaxKey =...
1
by: kalichakradhar | last post by:
hi I am new to VB 6.0 . I want to add new registry keys in teh system registry under HKEY_LOCAL_MACHINE and add key value to teh respective key. how can i access the system registry using VB 6.0?...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.