Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27384

Registry Startup Problem

$
0
0
Every registry startup code i find doesn't work.
ex:
Code:

Imports Microsoft.Win32
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

   

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim regStartUp As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)

        Dim value As String

        value = regStartUp.GetValue("Myapp")

        If value <> Application.ExecutablePath.ToString() Then

            regStartUp.CreateSubKey("Myapp")
            regStartUp.SetValue("Myapp", Application.ExecutablePath.ToString())

        End If
    End Sub
End Class

Givees me this error when i run:



I need a working registry startup code please!

Viewing all articles
Browse latest Browse all 27384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>