Have your app startup when user logs in
This is simple, but I thought it was kind of neat.
Public
Class Common
Private Const StartupRegistryFolder As String = "Software\Microsoft\Windows\CurrentVersion\Run"
Private Const StartupRegistryKey As String = "PSEDesktop"
Public Shared Property LaunchOnStartup() As Boolean
Get
Dim Key As RegistryKey = Registry.CurrentUser.OpenSubKey(StartupRegistryFolder)
If Not Key Is Nothing Then
Dim Value As String = DirectCast(Key.GetValue(StartupRegistryKey, String.Empty), String)
Key.Close()
Return Value <> ""
Else
Return False
End If
End Get
Set(ByVal Value As Boolean)
Dim Key As RegistryKey = Registry.CurrentUser.OpenSubKey(StartupRegistryFolder, True)
If Not Key Is Nothing Then
If Value Then
Key.SetValue(StartupRegistryKey, Application.ExecutablePath)
Else
Key.DeleteValue(StartupRegistryKey)
End If
Key.Close()
End If
End Set
End Property
End Class
Hopefully someone can find some use for it. Once you have this property in your application somewhere, you can link it to a CheckBox's Checked Property or something like that to let the user decide of they want your application to launch on startup or not.