How to add program to startup

Conejo

Well-known member
Joined
Jul 24, 2013
Messages
65
Location
USA
Programming Experience
1-3
So i have finally finished an antivirus i was making in vb but i dont know how to add it to startup. If someone knows how to change the registry key every time my program is opened then please help me.
 
thanks Learnerguy but i already found a very efficeint code here it is

Public Shared Sub AddStartup(ByVal Name As String, ByVal Path As String)
Dim Registry As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser
Dim Key As Microsoft.Win32.RegistryKey = Registry.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
Key.SetValue(Name, Path, Microsoft.Win32.RegistryValueKind.String)
End Sub
Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
AddStartup(Me.Text, Application.ExecutablePath)
End Sub
 
Back
Top