Hello,
I was wondering if i could get someone to help me. I'm new to VB.Net and Windows programming in general for that matter and am stuck on an issue.
I'm writing a program that creates a simple form, asking for values such as name,username,password, and email. After validating said fields, it writes the username and email to the registry as string values.
Everything works great except when i try to open the Reg key. The block of code looks something like this:
When i attempt to run this, it produces the following error:
first chance exception of type 'System.Security.SecurityException' occurred in mscorlib.dll
It seems to be failing at this line:
I've tried running this as administrator but it does the same thing.
If anyone has any suggestions they would be greatly appreciated!
Thank you!
makenna04
I was wondering if i could get someone to help me. I'm new to VB.Net and Windows programming in general for that matter and am stuck on an issue.
I'm writing a program that creates a simple form, asking for values such as name,username,password, and email. After validating said fields, it writes the username and email to the registry as string values.
Everything works great except when i try to open the Reg key. The block of code looks something like this:
VB.NET:
Imports Microsoft.Win32 'At top of form
----------------------------------------------------
Dim regAdd As RegistryKey
regAdd =Registry.CurrentUser.OpenSubKey("Software", True)
regAdd = regAdd.CreateSubKey("PCOpen")
regAdd.SetValue("Username", txtUserName.Text)
regAdd.SetValue("Email", txtEmail.Text)
regAdd.Close()
first chance exception of type 'System.Security.SecurityException' occurred in mscorlib.dll
It seems to be failing at this line:
VB.NET:
regAdd=Registry.CurrentUser.OpenSubKey("Software", True)
I've tried running this as administrator but it does the same thing.
If anyone has any suggestions they would be greatly appreciated!
Thank you!
makenna04
Last edited by a moderator: