by MrVBDude (1 Submission)
Category: Registry
Compatability: VB.NET
Difficulty: Unknown Difficulty
Originally Published: Tue 16th March 2010
Date Added: Mon 8th February 2021
Rating: (1 Votes)
This code will run your VB (Visual Basic) application on windows startup. Autorun on windows startup
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim regKey As Microsoft.Win32.RegistryKey
Dim KeyName As String = "MySampleApplication"
Dim KeyValue As String = "C:\test\test.exe"
regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
If regKey.GetValue(KeyName) = Nothing Then
'if there's no KeyName yet? then create and set it's value
MsgBox("No Program of this name found..!")
regKey.SetValue(KeyName, KeyValue, Microsoft.Win32.RegistryValueKind.String)
MsgBox("key " & KeyName & " has been created")
End If
End Sub
End Class
No comments have been posted about This code will run your VB (Visual Basic) application on windows startup. Autorun on windows startu. Why not be the first to post a comment about This code will run your VB (Visual Basic) application on windows startup. Autorun on windows startu.