473,387 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

how to make my visual basic 2010 application to autorun when windows starts

i was created an application in visual basic 2010 .but need to make my application to automatically run at windows start up.i know in vb6.0 but i dont know in vb2010 i got an idea to copy the application shortcut icon to windows start up folder may work but i dont know how to do that using coding this is my idea .if this works tell me the code if not tell me in u r way how to do that
Jul 29 '12 #1

✓ answered by PsychoCoder

It's a lot simpler than you know. The vale for getting your app to run on Windows load (Windows has to be loaded) in order for this to happen. If Windows aint loaded yet what happened?

Here's some sampler that shows how to get the right key and set it's value (I added an option to remove the value if you choose:

Expand|Select|Wrap|Line Numbers
  1. private void RunOnWindowsStartup(bool @checked)
  2. {
  3.     var key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
  4.  
  5.     if (@checked)
  6.     {
  7.         if (key != null) 
  8.             key.SetValue("ApplicationName", Application.ExecutablePath);
  9.     }
  10.     else if (key != null) 
  11.         key.DeleteValue("ApplicationName");
  12. }
Hope that helps :)

1 4287
PsychoCoder
465 Expert Mod 256MB
It's a lot simpler than you know. The vale for getting your app to run on Windows load (Windows has to be loaded) in order for this to happen. If Windows aint loaded yet what happened?

Here's some sampler that shows how to get the right key and set it's value (I added an option to remove the value if you choose:

Expand|Select|Wrap|Line Numbers
  1. private void RunOnWindowsStartup(bool @checked)
  2. {
  3.     var key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
  4.  
  5.     if (@checked)
  6.     {
  7.         if (key != null) 
  8.             key.SetValue("ApplicationName", Application.ExecutablePath);
  9.     }
  10.     else if (key != null) 
  11.         key.DeleteValue("ApplicationName");
  12. }
Hope that helps :)
Jul 30 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Sohail Carim | last post by:
does anyone know how to go about implementin an e-mail function directly from a vb . net application... I am a university student and this topic is giving me grey hair!
9
by: Jay Kim | last post by:
Hi, We're implementing a Windows application using Visual Basic .NET. One of the key features we need to implement is that we should be able to get the accurate byte offset of user selected...
7
by: etam | last post by:
How, by code can i set the program to be started when windows is started? Do sth with some files like in linux or what? -- Pozdrawiam, Etam.
3
by: Patrick Dugan | last post by:
I am using VS2005 (vb) and I have a program that starts when Windows boots up. Occasionally the icon that should appear in the system tray does not show up. The program is still running in memory...
4
by: Virox | last post by:
I don't know how to make visual basic press a key using code, can someone help me?!
3
by: cugone | last post by:
I'm looking for a way to import C# namespaces (stored in a *.cs file) into a visual basic 2005 application. I'm attempting to write an application that uses DirectX and all of the helper functions...
2
by: Blair | last post by:
Can someone please tell me how to start my application when Windows starts up or when someone logs on (vb 2005) ?
10
by: =?Utf-8?B?V2VuZHkgRWxpemFiZXRo?= | last post by:
Questions about creating an .net ‘executable’ 2005 that will not remained installed once a user enters some data into the application. I also want this applcation to not require any previous...
3
by: mikeyeli | last post by:
Good Day people! i need to make an application im making, start when windows starts, i just wanted to ask you how can i do this, or to point me in the right direction. Thanks!
6
siddnair54
by: siddnair54 | last post by:
Hey Guys, i have created a windows application in c#. I want to create a setup in such a way that once the application is installed, it should start automatically when the windows starts up. Can you...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.