Writing to registry in vb.net 2013

Hey Guys

I am clueless yes  I write in VB .NET CAUSE I'M NOT THAT GOOD AT  PROGRAMMING ANYWAY ALL I WANT  TO DO IS JUST  WRITE  A FEW VALUES FOR A AUTOLOGON USING VB.NET HOW WRONG  AM I

Imports Microsoft.Win32

Public Class Form1
    Dim regKey As RegistryKey
    Dim regKey1 As RegistryKey

    Dim regKey2 As RegistryKey
    Dim regKey3 As RegistryKey
    ' Public Function  
    Public Function CreateSubKey(subkey As String, permissionCheck As Microsoft.Win32.RegistryKeyPermissionCheck) As Microsoft.Win32.RegistryKey
    End Function
    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        txtTimeandDATE.Text = Date.Now
    End Sub
    Public Sub Labs()
        txtPass.Text = "Nazareth1"
        regKey = Registry.LocalMachine.CreateSubKey("\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", True)
        regKey.SetValue("AutoAdminLogon", "1")
        regKey1 = Registry.LocalMachine.CreateSubKey("\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", True)
        regKey1.SetValue("DefaultDomainName", "ONE")
        regKey2 = Registry.LocalMachine.CreateSubKey("\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", True)
        regKey2.SetValue("DefaultUserName", cmbUser.SelectedValue)
        regKey3 = Registry.LocalMachine.CreateSubKey("\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", True)
        regKey3.SetValue("DefaultPassword", txtPass.Text)
    End Sub

Open in new window

please help thanks guys
tompowers2474Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
What is the issue that you have? I see that you are trying to write to HKLM. You should write to HKCU (current user). HKLM requires privileges.

Also have a look at http://emoreau.com/Entries/Articles/2003/10/Using-the-registry-from-a-VBNet-application.aspx

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tompowers2474Author Commented:
Thank You
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.