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

[SOLVED]Need help removing registry key

$
0
0
I have created an application with 2 buttons. Button 1 adds application as startup in current user.
Button 2 should remove the registry key. However i'm not sure of the code to remove the key. Can anyone help?
My code:
Code:

Imports Microsoft.Win32
Public Class Mainform

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim regStartUp As RegistryKey = Registry.CurrentUser.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

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
       
    End Sub
End Class

Thanks.

Viewing all articles
Browse latest Browse all 27554

Trending Articles



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