Start on start-up

Posts 1–6 of 6 · Page 1 of 1
Start on start-up
hey what is the code for if i have a checkbox on my app and when that checkbox is checked = the program will start on start up next re boot? then once unchecked it will not start on start up?
No on startup. like what aim does and messenger. it just auto starts when windows opnes
Quote Originally Posted by Tortaleni View Post
Code:
Imports System.IO
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim FileName As String Dim FilePath As Object Dim RegistryKey As Object FileName = "StartupTutorial.exe" FilePath = Path.GetFullPath(FileName) RegistryKey = CreateObject("WScript.Shell") RegistryKey.RegWrite("HKEY_LOCAL_MACHINE \SOFTWARE\Microsoft\Windows\CurrentVersi on\Run\StartupTutorial", FilePath) End Sub
End Class
change " STARTUP TuT' to what ever your project is!
Code:
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 
Dim FileName As String
 Dim FilePath As Object
 Dim RegistryKey As Object
 FileName = "StartupTutorial.exe"
 FilePath = Path.GetFullPath(FileName)
 RegistryKey = CreateObject("WScript.Shell") RegistryKey.RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\StartupTutorial", FilePath) End Sub
End Class
=P
Or

Code:
Dim RegistryK As RegistryKey
RegistryK = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
RegistryK.SetValue("Your FIle Name.exe", "Your FIle Location\Your FIle Name.exe")
RegistryK.Close()
or

Code:
My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True).SetValue(Application.ProductName, Application.ExecutablePath)

1 line of code.
Posts 1–6 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us