private void BackButton_Click(object sender, System.EventArgs e) { //if condition checks whehter increasing the month takes it into the next year and acts accordingly try { if (m_selectedMonth == UmAlQuraInstance.GetMonthsInYear(m_selectedYear)) { m_selectedYear += 1; m_selectedMonth = 1; } else { m_selectedMonth += 1; } } catch (ArgumentException exception) { MessageBox.Show(exception.Message); } try { if (m_selectedDay == 30 && UmAlQuraInstance.GetDaysInMonth(m_selectedYear, m_selectedMonth) < 30) { m_selectedDay = 29; } } catch (ArgumentException exception) { MessageBox.Show(exception.Message); } Painter(); }