I have a for loop that check whether some checkboxes are checked
foreach (CheckBox chk in this.Controls.OfType<CheckBox>())
{
if (chk.Checked)
{
//Some code here
}
}
There are 12 checkboxes, 1 for each month.
What i want is to calculate the number of days between a variable StartDate and the last month. It's hard to explain sorry.
For example, StartDate = 1st September 2010
, Checked Boxes are April, October and December.
The result should be the days between 01/09/2010 and 01/04/2011.
If StartDate = 1st November 2010 then the result would be the days between 01/11/2010 and 01/10/2011.
I'm think I struggling because the loop goes from jan to dec. If it was started from the startdate month I'd be OK.
Please ask some questions if i need to explain more.