private void CreateAndFillData(FlowLayoutPanel[] panels) { int startMonth, tempMonth; int startYear, tempYear; if (radDates.Checked) { startMonth = dtpFrom.Value.Month; startYear = dtpFrom.Value.Year; } else { startMonth = 1; startYear = yearTotals.StartYear; } tempMonth = startMonth; tempYear = startYear; for (int i = 0; i < 12; i++) { if (tempMonth == 13) { tempMonth = 1; tempYear++; } Helper.CreateLabel(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(tempMonth), panels[i], "None", "Header"); tempMonth++; } lblDate.Invoke((MethodInvoker) delegate() { lblDate.Text = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(startMonth) + " " + startYear.ToString() + " To " + CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(tempMonth - 1) + " " + tempYear.ToString(); }); Helper.CreateLabel("Total", fltotal, "None", "Header"); for (int i = 0; i < 12; i++) { if (startMonth == 13) { startMonth = 1; startYear++; } MonthlyReports.GetMonthlyFigures(startMonth, startYear, panels[i], "Full", yearTotals); startMonth++; } }