Date picker selection change
I have two Datepicker named datepicker1 and datepicker2 .I have a textbox also.datepicker1 shows the current date and datepicker2 shows a date of six monthes later from now.I want to show the difference in monthes in the textbox when i put the date in the datepicker2.How can i implement this on selection change event using the datepicker2.plz help me.Thanks in advance.

Sanjeeb LenkaPosted Feb 10, 2014, 2:17 AM
try like this: it may help you
private void dateTimePicker2_ValueChanged(object sender, EventArgs e)
{
DateTime dt = this.dateTimePicker1.Value.Date;//1st date
DateTime dt2 = this.dateTimePicker2.Value.Date;// selected date
int months = (dt2.Year - dt.Year) * 12 + dt2.Month - dt.Month;
textBox1.Text = months.ToString();
}
Ronok BhowmikPosted Feb 10, 2014, 3:45 AM