narasiman rao

narasiman rao

  • NA
  • 519
  • 771.7k

selected month date want to display in datagridview using c

Feb 22 2013 8:32 AM
I want selected month date want to display in datagridview using c sharp.

My  Code as follows;

private void Faculty_Available_Calendar_DateChanged(object sender, DateRangeEventArgs e)
        {
              
             DGVCalendar.Rows.Clear();
             DateTime dt1 = Faculty_Available_Calendar.SelectionStart;
             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-yy");
                 dt1 = dt1.AddDays(1);
                 row++;
            }
         
        }



In datagridview ouput as follows; (when i select march month means that month all dates want to display in datagridview)

  Select           Month(Name)  (column Name)

    Checkbox   1/3/2013 to 31/3/2013(dsiplay in datagridview)


When i select the month in (Month Calendar Control) in run mode,Error shows as follows;

string was not recognized as valid Boolean.'

This error happen when i add  Checkbox in datagridview.

suppose i remove the Checkbox in datagridview, Correctly working why?

I want to add checkbox, so that select the date and save in database.


Answers (2)