Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
code shows me current date , i need previous and current date.

dateTimePicker1.MinDate = dateTimePicker1.MaxDate = DateTime.Now;
Posted

1 solution

Try this...
C#
dateTimePicker1.MinDate = DateTime.Now.AddDays(-1); //previous date
dateTimePicker1.MaxDate = DateTime.Now; //current date

Happy Coding!
:)
 
Share this answer
 
v2
Comments
Master Vinu 2-Jan-13 5:45am    
Error 8 'System.DateTime' does not contain a definition for 'Adddays' and no extension method 'Adddays' accepting a first argument of type 'System.DateTime' could be found (are you missing a using directive or an assembly reference?) G:\Spareage\Lib\CRSpareageFinance\GateForm\InventoryEntry.cs 385 60 CRSpareageFinance
Aarti Meswania 2-Jan-13 5:49am    
case sensetive it's
AddDays not Adddays
Master Vinu 2-Jan-13 5:57am    
thx aarti
Aarti Meswania 2-Jan-13 5:58am    
Welcome! :)
Glad to help you! :)
ridoy 2-Jan-13 6:30am    
+5

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