Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,

how can i enable calendar till present year and disable all the years after present year??

C#
dtpyear.DisplayDateEnd = DateTime.Now;

It enable date selection in calendar till today but want to enable till this year.

Any idea or any link....
Posted
Updated 4-Dec-13 15:45pm
v2

1 solution

you can try this way.....

C#
private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            int year = DateTime.Now.Year;
            dtpyear.DisplayDateEnd = new DateTime(year, 12, 31);
            
        }


Hope it helps you....
 
Share this answer
 
Comments
kida atlantis 4-Dec-13 21:51pm    
thanks it is working .....
keerth516 4-Dec-13 21:52pm    
your welcome ,instead of posting your question here you could have search in google...you could get many ways to do it.

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