problems with month calendar c #


I have a problem with MonthCalendar of c# , I will briefly explain ...

I have a form where you get dates from a data base SQL , at the time of finding dates they are marked in bold in MonthCalendar .

By doing click on that date, I display a report that I created to show information related to that date, but at the time of changing the date, on the arrow above, in change of month or year, it is pasted and many empty reports start coming out collapsing the software, I need your help please.

private void monthCalendarProgramacion5_DateChanged (object sender, DateRangeEventArgs e)
        //con esto puedo visualizar la fecha a la cual se selecciona y convertirla en string para pasarla a un textbox
        textBox5.Text = monthCalendarProgramacion5.SelectionRange.Start.ToShortDateString();
        //se iniciliza el formulario reporte para visualizar los datos
        FormMostrarMonthCalendar4 month = new FormMostrarMonthCalendar4();
        //se pasa el dato en fecha al parametro del formulario reporte para el procedimiento
        month.fechaOT3 = monthCalendarProgramacion5.SelectionRange.Start.Date;
        //se iniciliza el formulario para mostrar los datos
    catch (Exception ex)
        MessageBox.Show("fallo" + ex);
asked by Patricio Riquelme 19.11.2018 в 19:30

1 answer


You should use the event

MonthCalendar.DateSelected Event

unlike the DateChanged this is executed when there is a specific selection of the date

In the documentation he mentions


This event is similar to the DateChanged event, but occurs at the end of a date selection made by the mouse. The DateChanged event occurs during any date selection, either by mouse, keyboard or code

answered by 19.11.2018 в 20:28