I am hoping someone can help me out. I have created a usercontrol in C# for use on a Winform. The control contains various controls including a monthCalendar control however the monthCalendar control is where my problem lies.
I want the parent form that holds my usercontrol to trigger a block of code to query a database using linq when the dateSelected event of the monthCalendar within the usercontrol is triggered. The idea being that the usercontrol should not be aware of the data access side of things so that the usercontrol can be used in other projects.
What I was hoping was that there was a way that I could make the dateSelected event available to the parent form; I have done this successfully with click events etc for other controls I just can't seem to make this work for the monthCalendar as DateSelected uses DateRangeEventHandler rather than the standard EventHandler.
I hope this is clear as i have been around the block with this one so i'm not sure what makes any sense any more :) Any help or advice in how I could go about coding this would be very much appreciated.
Same way you would with the Button events.
In your UserControl, it would look something like this:
Then in your form, like all controls with events: