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