Question

let's say I have selected the date 12/22/2012

then I go on and select 11/19/2009.

I then try to so some code in

private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)

How would I be able to retrieve the date 12/22/2012? Would I need to keep some variables to do this? or is there something I could do to retrieve it?

Was it helpful?

Solution

Try and tweak this,Create a static class and a variable previousDate in it and put some initial value to it,

private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)
{
    string previous = myStaticClass.previousDate;
    current = monthCalendar1.SelectionRange.Start.ToShortDateString();
    myStaticClass.previousDate=current ;
}

OTHER TIPS

Try something similar to this:

private string previous { get; set; }
private string current { get; set; }
private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e)
{
    previous = current;
    current = monthCalendar1.SelectionRange.Start.ToShortDateString();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top