Click here to Skip to main content
15,887,585 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
If you see windows 7's date in task bar it changes date automatically after each day. I need the same concept in my c# window form.

For example:
Today is 10/27/2017 when I open my c# form today my form calendar date must set to 10/27/2017,when I open my form tomorrow my from calendar date must set to be 10/28/2017.and so on....
Howe can I set my c# window form calendar like that concept.

Note: I don't want to use system date like: DateTime.Now

What I have tried:

MonthCalendar1.TodayDate = new System.DateTime(2017, 10, 1, 0, 0, 0, 0);
Posted
Comments
Karthik_Mahalingam 2-Nov-17 2:11am    
try
 var date = DateTime.Now.AddDays(-6);
Member 13493074 2-Nov-17 3:29am    
Thanks if I use var date = DateTime.Now.AddDays(-6); does the date in my application calendar changes after each day, even if the user changes it is system date.
Example: if var date = DateTime.Now.AddDays(-6) set my calendar date to 11/2/2017 and then the user changes his system date, does these changes in system date affect my Application calendar or not.
Thanks again from your help.
Karthik_Mahalingam 2-Nov-17 3:31am    
No, it picks the reference date from system, but if you can store the reference date in the app.config file or settings file or read from the server if your app has internet access.
ZurdoDev 2-Nov-17 8:17am    
I suggest posting as solution.
Karthik_Mahalingam 2-Nov-17 8:34am    
Still the OP has some confusion with the query.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900