Forum guidelines
AuthorQuestion
DatetimePicker Control
Posted By soma sundaram on 12 May 2008

Hi All,

I am using two Datetimepicker controls. one is Licence strat date and another one is Licence End date..But Licence start date is Current date default today date and Licence End date will add 1 day plus 2 years. 

when i select the Start date and Automatically End date will add 2 years plus 1 day...So how to do??????



for example Thus for Licence Start date 01/02/2008 the date will be End Date 31/01/2010...So how to do in C# Windows Application...So please reply.....

regards

Somasundaram G


Somasundaram G
AuthorReply
Re: DatetimePicker Control
Posted By Patricia Probst on 12 May 2008  

when i select the Start date and Automatically End date will add 2 years plus 1 day...So how to do??????

Select the start datepicker and on the properties page, go to "Events" and double click "Value Changed" event (this is going to create a method for the dtp).  Place this code inside of your method:

//Remove a day from your start date

DateTime dayBefore = dtpStartDate.Value.Subtract(TimeSpan.FromDays(1));

//Add 2 years from the day before your start date

dtpEndDate.Value = dayBefore.AddYears(2);

It should work....


Patricia Probst
Re: DatetimePicker Control
Posted By soma sundaram on 12 May 2008  

Thankyou very much..Thanks lot


Somasundaram G
Re: DatetimePicker Control
Posted By Patricia Probst on 13 May 2008  
You're welcome!
Patricia Probst
Re: DatetimePicker Control
Posted By soma sundaram on 05 Jun 2008  

Hi all,

Iam using DatetimePicker control in Visual C#.Net 2.0

Its woking fine... thanks lot...Actually i need  Default startDate and default End date add 2 years + 1 day 

when i run the application has to display the Start date is Current date and End Date is 2years + 1 day..So how to do..and Which event i have to write the code...Pls tell me asp...

thanks

Regards

Somasundaram G

 

Which

 

 


Somasundaram G

SPONSORED BY

Custom Software Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.