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


Top 5 Contributors of the Month
david stephan

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#
Hi,

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.


Responses
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
or
datetimepickername.MaxDate == DateTime.Today;
This disables the user from selecting the past dates

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

Hi,

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

dateTimePicker1.CalendarForeColor = Color.LightGray;


Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/


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
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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