Reputation: 7694
there is a MonthCalender in C#
There is a 2 buttons to select the month
Jan, Feb and so on..
Anyway I can detect that the user changed the month?
Upvotes: 2
Views: 3425
Reputation: 833
use OnVisibleMonthChanged
on calender control and create event something like this:
protected void Calendar1_VisibleMonthChanged(object sender, MonthChangedEventArgs e)
{
// Further processing goes here
}
Upvotes: 0
Reputation: 7892
try this
private int MonthValue = 0;
private bool bChanged = false;
private void Form1_Load(object sender, EventArgs e)
{
MonthValue = monthCalendar1.TodayDate.Month;
}
private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)
{
if (MonthValue != monthCalendar1.SelectionStart.Month)
{
//changed
bChanged = true;
MonthValue = monthCalendar1.SelectionStart.Month;
}
else
{
//not changed
bChanged = false;
}
}
Upvotes: 3