Here I have created one windows application (Scheduler) it is having some listbox,checkbox, buttons. I just need to run that application when windows log on particular set of time it should run.
-
Do you mean you want to put it at start up and after the user login, it runs? – Reza Aghaei Oct 08 '15 at 08:04
-
Yup exactly...! @RezaAghaei – Santosh Kokatnur Oct 08 '15 at 08:13
-
Possible duplicate of [Run the application at Windows startup](http://stackoverflow.com/questions/5089601/run-the-application-at-windows-startup) – CodeCaster Oct 08 '15 at 08:18
-
So the premise of your question is incorrect. You're not at all looking for a Windows Service, just for a way to let your application start up when a user logs in. – CodeCaster Oct 08 '15 at 08:18
-
Brother @CodeCaster Actually, i want to run this app in the background. when a user click Monday or wednesday checkboxes and if he shutdown the pc and restart it again, so when he restarts again he should get the same task the selected days will appear from the app.. and it should run in background like windows service – Santosh Kokatnur Oct 08 '15 at 08:21
-
It's really unclear what exactly you want to do, and I'm not sure why a Windows Service would help here. Don't you just want to persist what the user enters, for example to XML, then load the XML upon startup? – CodeCaster Oct 08 '15 at 08:23
-
Ya, Please Tell me how to load the xml file in startup? i have created XML file already in my application @CodeCaster – Santosh Kokatnur Oct 08 '15 at 08:30
-
1Show relevant code. Or rather, try to search first. – CodeCaster Oct 08 '15 at 08:30
-
1:10:39 PM 6 True False True -
I strongly recommend using a Setting file to store user selected value, this way, you can simply handle multiple users. – Reza Aghaei Oct 08 '15 at 08:38
-
okay! what all i have to do to set the user value? 2 – Santosh Kokatnur Oct 08 '15 at 08:39
-
1Look; this question is now a mess. You have an irrelevant, now-removed answer, you have an answer that answers your initial question which was the wrong question and there's way too many comments. Please delete the question, edit it into shape as explained in [ask] and then undelete it. Your actual question is _"How to load an XML file at application startup"_, for which we need to see the code that writes the XML file. – CodeCaster Oct 08 '15 at 08:43
-
Probably there is a setting file in Properties folder of your solution, if there is not, you can Simply Add a Setting file to your that folder (Add New Item-> Setting) then open settings designer and add some properties and select scope User. then you can use those settings `Properties.Settings.SomeKey=SomeValue` and save `Properties.Settings.Default.Save();` – Reza Aghaei Oct 08 '15 at 08:44
-
Thank you! @RezaAghaei brother – Santosh Kokatnur Oct 08 '15 at 08:48
-
You are welcome, But I agree @CodeCaster and I think you should keep a question specific and ask a new question about other aspects of your application, like settings. – Reza Aghaei Oct 08 '15 at 08:50
-
1@Santosh I'm not angry, just trying to help you ask an answerable question. – CodeCaster Oct 08 '15 at 08:51
-
ok :) @RezaAghaei brother – Santosh Kokatnur Oct 08 '15 at 08:52
-
@SantoshKokatnur Welcome to StackOverflow :) – Reza Aghaei Oct 08 '15 at 08:53
-
I am very much thankful to you brother @RezaAghaei – Santosh Kokatnur Oct 08 '15 at 08:56
-
@SantoshKokatnur you are welcome. – Reza Aghaei Oct 08 '15 at 08:57
-
hope you got a mail.... @RezaAghaei – Santosh Kokatnur Oct 08 '15 at 08:59
-
2Sorry brother @CodeCaster I thought you were angry ... – Santosh Kokatnur Oct 08 '15 at 09:01
1 Answers
If you want to put your application in start up and check user selected date and time and show the form to user at that times:
- Change your application main form to be hidden. (for example
this.Hide()
, orthis.Visible= false
inLoad
event) - Save the user selected date and time in a setting file.
- create a timer that checks current date and time, and if this is the time to run, show the main form.
- Then put your application at start up.
Put application in startup
Option 1:
If you need put your application at start up programmatically, you can do it using this registry key. Write a C# code to open the key:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\
And then create string value and set a name for it and in value, put address of .exe of your appplication.
Option 2:
If you want to put your application in start up manually, you can simply put your application in startup using Addministrative Tools -> Task Scheduler -> Create Basic Task and then in wizard, In Task Trigger Page, Select When I logon.
Key Points:
If you use a
.Setting
file in your project, the settings will be saved per user and you should not be worry about settings of different users.If you put program at startup using registry or task scheduler, the program runs after user logon.
Registry trick can be applied during installation or at first run of application.

- 120,393
- 18
- 203
- 398
-
what about other users of this application? can he/she do the same thing as you said??? – Santosh Kokatnur Oct 08 '15 at 08:24
-
@SantoshKokatnur Absolutely yes, `Settings` infrastructure supports user specific settings and the application runs for each user account in both task scheduler or registry trick. – Reza Aghaei Oct 08 '15 at 08:26
-
1i want, when user can install this app, they need not to do all the things like go to settings and create a task.. these all... it will be like user friendly... @Reza brother – Santosh Kokatnur Oct 08 '15 at 08:28
-
1Thank you so much Brother... Can i have your mail ID, so that i can contact you, if any queries... – Santosh Kokatnur Oct 08 '15 at 08:34
-
Yes you can, but I think here is a better place to ask questions, this way questions and answers will be useful for other users too:) any way here is my contact info r.aghaei at outlook .com – Reza Aghaei Oct 08 '15 at 08:45