[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 227
  • Last Modified:

What event do I intercept when using a MonthCalendar object?

Greetings,

When using a MonthCalendar, I am having trouble finding the event to handle in order to capture a user click on a given date.  I'd like to capture that event so I can display the date on a button, which they can press to hide the MonthCalendar.

Does anybody know which event to handle?

Thanks,
Bob
0
ba272
Asked:
ba272
  • 2
  • 2
1 Solution
 
aaronfengCommented:
Try this:

this.monthCalendar1.DateChanged += new DateRangeEventHandler(monthCalendar1_DateChanged);

void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e) {
      button1.Text = this.monthCalendar1.SelectionEnd.ToString();
}

Cheers,

Aaron
http://aaronfeng.blogspot.com/
0
 
ba272Author Commented:
Thanks.

Would you happen to know how to get the selected date from the control?

Thanks,
Bob

PS Nice site.
0
 
aaronfengCommented:
You want to get the date user just clicked on right?

So it would be this (it's also listed above):

this.monthCalendar1.SelectionEnd.ToString();

Cheers,

Aaron
0
 
ba272Author Commented:
Thanks.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now