selected date want to display in datagridview using csharp
Design as follows
Calendar (control name month calendar)
Note: it is windows application.
Run mode as follows;
In the run mode when i select any month and click, that month all dates want to display in dategridview.
My code as follows;
private void Facavailcal_DateChanged(object sender, DateRangeEventArgs e)
{
DateTime dt1 = Facavailcal.TodayDate;
dt1 = new DateTime(dt1.Year, dt1.Month, 1);
DateTime dt2 = dt1.AddMonths(1);
int numDays = (dt2 - dt1).Days;
if (DGVCalendar.RowCount < numDays)
{
DGVCalendar.RowCount = numDays;
}
int row = 0;
while (dt1 < dt2)
{
DGVCalendar.Rows[row].Cells[0].Value = dt1.ToString("dd/MM/yyyy");
dt1 = dt1.AddDays(1);
row++;
}
}
in the above code, in the run mode in the calendar february month is
there,when i select the that month all date is display in datagridview.
suppose when i select march month means, that month all date is not display in dategridview.
from my above code what is the problem.
please help me.