Windows Develop Bookmark and Share   
 index > Windows Forms General > setting a date in the calendar control
 

setting a date in the calendar control

Hello.
I am writing ASP.NET app using VS2005
I am trying to set default value in the calendar control. but it doesn't seem to work...
My code

Code Snippet

DateTime cc = new DateTime(2000,1,1);

Calendar1.SelectedDate = cc;

Why doens't it selects the day in the calendar control? (I didn't use any formatting options or set any properties. I just dragged and droped the calendar control from the tool box and added the above code to the "Page_Load" method.

thank you
Roy


roy-roy  Thursday, July 05, 2007 11:25 PM

It does set the selected date. You also need to set the Calendar1.VisibleDate.

Code Snippet

DateTime cc = new DateTime(2000, 1, 1);

Calendar1.SelectedDate = cc;

Calendar1.VisibleDate = cc;

KJacquemin  Friday, July 06, 2007 12:29 AM

It does set the selected date. You also need to set the Calendar1.VisibleDate.

Code Snippet

DateTime cc = new DateTime(2000, 1, 1);

Calendar1.SelectedDate = cc;

Calendar1.VisibleDate = cc;

KJacquemin  Friday, July 06, 2007 12:29 AM

That will explain why it didn't work...

Thanks a lot!

roy-roy  Saturday, July 07, 2007 11:59 PM

You can use google to search for other answers

Custom Search

More Threads

• WinForm IO Exceptions on Lan
• Using AxWebBrowser - without using interop
• How to get Property attributes dynamically.
• DataGridViewCheckBoxCell - programatically set value
• visual c# treeview multiple
• loading animated gif while sql query is executing
• Print Windows Form
• can any one help me
• Table existence in a database
• Determining events across multiple controls