This is something very useful this is will work on all windows versions because we are using registry and registry is the only way add programs to startup so lets get started making it. You need a button to add your application to startup and you need another button to remove your application from startup, you can also use checkbox instead buttons but i recommend buttons because that is the control that mostly suit for the work so when you add to buttons edit there property TEXT as given below
button1 - Add
button2 - Remove
Double click your button1 and add this code . dont forget to replace application name with your application name and one more thing dont forget to add the same application name to button 2 click event
button1 - Add
button2 - Remove
Double click your button1 and add this code . dont forget to replace application name with your application name and one more thing dont forget to add the same application name to button 2 click event
Dim startwhenwindowsstarts As Microsoft.Win32.RegistryKey startwhenwindowsstarts = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True) startwhenwindowsstarts.SetValue("application name", Application.ExecutablePath) startwhenwindowsstarts.Close()Double click button 2 and add this code
Dim removefromstartup As Microsoft.Win32.RegistryKey removefromstartup = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True) removefromstartup.DeleteValue("application name") removefromstartup.Close()When you click button1 your application will be ready to start itself when windows starts and you can remove it by clicking buton2
if you have any problems please comment below
3 comments
how find a string Registry to check, deleted or added :/
ReplyAt the same time, parents won’t lose their piece of mind when the child is not responding for a while. It is better to use the locator for better purposes such as finding the lost phone. Look at family locator here!
ReplyPost a Comment
Note: Only a member of this blog may post a comment.