Problem: Sometimes we need to get a result of financial years(...2011-2012, 2012-2013,
2013-2014) starting from the date given by me to till 5 year in a
dropdown list.
Solution: Lets say we received the given date from text box:-
Hope this will solve your problem.....
Solution: Lets say we received the given date from text box:-
DateTime GivenDate = Convert.ToDateTime(textBox1.Text);
int GivenYear = GivenDate.Year;
for(int i=0; i<5; i++)
{
comboBox1.Items.Add(GivenYear + i + "-" + (GivenYear + 1 + i));
}
Hope this will solve your problem.....
No comments:
Post a Comment