.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Imran Ghani
Sohaib Khalid

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

Deselect date

Posted By: Dhivya     Posted Date: May 04, 2012    Points:5   Category :C#

I want to unselect the future dates but not today's date from a week from today's date and i want to unselect previous date also.

For eg.Today is a friday ,i want to make user not able to select from next friday. pl help me.

Author: Karthik             
Posted Date: May 06, 2012     Points: 20   

Hello Divya,

You may try using MIN date and MAX date methods in C#.
Try using this code snippet given below in your Form Load Event (if you are using windows apps)

datetimepickername.MinDate == DateTime.Today;
This disables the user from selecting the future dates
datetimepickername.MaxDate == DateTime.Today;
This disables the user from selecting the past dates

Author: Narayanan             
Posted Date: May 10, 2012     Points: 20   


Check this
  dateTimePicker1.MinDate = DateTime.Now;
dateTimePicker1.MaxDate = DateTime.Now;

dateTimePicker1.CalendarForeColor = Color.LightGray;

Regards, Lakshmi Naraayanan.S

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend