DateTimepicker (My Requriement)
I have 2 datepicker name start date and end date..
End date should not be greater than 1 year of Start date...
example:
Start date-01.04.2009
End date-31.03.2010(End date picker should not allow 2011)
what can i do for this?

jingeRank #2,527 · 554 reputationPosted Oct 24, 2009, 3:36 AM EDT
void dateTimePicker2_ValueChanged(object sender, EventArgs e) { if (TimeSpan.FromTicks(this.dateTimePicker2.Value.Ticks - this.dateTimePicker1.Value.Ticks).Days >= 365) { MessageBox.Show("interval can not be more than one year"); dateTimePicker2.Value = dateTimePicker1.Value; } }jingeRank #2,527 · 554 reputationPosted Oct 24, 2009, 2:06 AM EDT
http://social.msdn.microsoft.com/Forums/en-US/winformsdesigner/thread/33c0f2c2-45be-48a7-b888-53498dc850f3
Amit ChoudharyRank #145 · 15.8K reputationPosted Oct 24, 2009, 2:54 AM EDT
Let me know so that i can have more specific words of solution.
manikandan rRank #3,426 · 422 reputationPosted Oct 24, 2009, 3:23 AM EDT
Kirtan PatelRank #292 · 8.6K reputationPosted Oct 24, 2009, 3:39 AM EDT
Here is Code According to Your Requirement Just 2 Lines to Write :)
check "Do you like this answer" if it helps you :)
private void Form1_Load(object sender, EventArgs e) { dtpEndDate.MaxDate = dtpStartDate.Value.AddYears(1); } private void dtpStartDate_ValueChanged(object sender, EventArgs e) { dtpEndDate.MaxDate = dtpStartDate.Value.AddYears(1); }jingeRank #2,527 · 554 reputationPosted Oct 24, 2009, 5:01 AM EDT