G
Guest
I am putting together a app that on startup needs to check if a registry key
exists, if not it will popup one window and if it does popup another. I have
the framework for this functioning fine on my dev machine, but when I try to
run it I get a couple of errors related to Registry Permissions.
I have searched around for tips on ways to do this but only find parts
spread all over the place, and none of them seem to plug in well together.
Does anyone have a suggestion as to how it might be better to handle this?
Here is what I am doing!
<!--Code
<Assembly: RegistryPermissionAttribute(SecurityAction.RequestMinimum,
All:="HKEY_CURRENT_USER\SOFTWARE\Premier Data Services")>
Public Class frm_Main
Inherits System.Windows.Forms.Form
Public Shared Sub Main()
Dim keyLocale As String
keyLocale = "SOFTWARE\Premier Data Services\NEPA Tracking"
Dim pdsAppKey As Microsoft.Win32.RegistryKey
pdsAppKey = Registry.CurrentUser.OpenSubKey(keyLocale, False)
If pdsAppKey Is Nothing Then
Application.Run(New frm_NewUser)
Else
Application.Run(New frm_Main)
End If
End Sub
EndCode -->
Thanks!
exists, if not it will popup one window and if it does popup another. I have
the framework for this functioning fine on my dev machine, but when I try to
run it I get a couple of errors related to Registry Permissions.
I have searched around for tips on ways to do this but only find parts
spread all over the place, and none of them seem to plug in well together.
Does anyone have a suggestion as to how it might be better to handle this?
Here is what I am doing!
<!--Code
<Assembly: RegistryPermissionAttribute(SecurityAction.RequestMinimum,
All:="HKEY_CURRENT_USER\SOFTWARE\Premier Data Services")>
Public Class frm_Main
Inherits System.Windows.Forms.Form
Public Shared Sub Main()
Dim keyLocale As String
keyLocale = "SOFTWARE\Premier Data Services\NEPA Tracking"
Dim pdsAppKey As Microsoft.Win32.RegistryKey
pdsAppKey = Registry.CurrentUser.OpenSubKey(keyLocale, False)
If pdsAppKey Is Nothing Then
Application.Run(New frm_NewUser)
Else
Application.Run(New frm_Main)
End If
End Sub
EndCode -->
Thanks!