IrvineCAGuy
New member
- Joined
- Nov 30, 2010
- Messages
- 4
- Programming Experience
- 10+
I am creating a schedule calendar where the header columns are set to show the next 7 days as | User name | Mon | Tue | Wed| Thu| Fri | Sat | and the first row is...
| |11/20|11/30| etc.
Then I want to set the "dates" cells with a checkbox in each. My code is:
For iDriverLoop = 0 To .Rows.Count - 1
oDataRow = New DataGridViewRow
oDataCell = New DataGridViewTextBoxCell
oDataCell.Tag = (.Rows(iDriverLoop).Item("iDriverID"))
oDataCell.Value = (.Rows(iDriverLoop).Item("sDriverCode"))
oDataRow.Cells.Add(oDataCell)
oDataCell = New DataGridViewTextBoxCell
oDataCell.Value = (.Rows(iDriverLoop).Item("sDriverName")
oDataRow.Cells.Add(oDataCell)
For iDayLoop = 0 To iNumberOfDays
oDataCell = New DataGridViewCheckBoxCell
oDataRow.Cells.Add(oDataCell)
Next
' Add in this row
Me.DGSchedule.Rows.Add(oDataRow)
Next
The code runs, but when the control render I et "System.FormatException: Formatted value of the cell has the wrong type.
Do I have to create a CheckBoxColumn type - then I won't be able to display text in the first datarow in the 'checkbox' columns?
| |11/20|11/30| etc.
Then I want to set the "dates" cells with a checkbox in each. My code is:
For iDriverLoop = 0 To .Rows.Count - 1
oDataRow = New DataGridViewRow
oDataCell = New DataGridViewTextBoxCell
oDataCell.Tag = (.Rows(iDriverLoop).Item("iDriverID"))
oDataCell.Value = (.Rows(iDriverLoop).Item("sDriverCode"))
oDataRow.Cells.Add(oDataCell)
oDataCell = New DataGridViewTextBoxCell
oDataCell.Value = (.Rows(iDriverLoop).Item("sDriverName")
oDataRow.Cells.Add(oDataCell)
For iDayLoop = 0 To iNumberOfDays
oDataCell = New DataGridViewCheckBoxCell
oDataRow.Cells.Add(oDataCell)
Next
' Add in this row
Me.DGSchedule.Rows.Add(oDataRow)
Next
The code runs, but when the control render I et "System.FormatException: Formatted value of the cell has the wrong type.
Do I have to create a CheckBoxColumn type - then I won't be able to display text in the first datarow in the 'checkbox' columns?