I tried to test whether myDataGridViewCell is a DataGridViewCheckBoxCell
if(myDataGridViewCell.ValueType is DataGridViewCheckBoxCell) ...
but this gives the warning:
The given expression is never of the provided ‘System.Windows.Forms.DataGridViewCheckBoxCell’) type
How can you test the type of a DataGridViewCell?
ValueTypeis the type of the data values that the cell holds. That’s not what you want.To test the type of the cell itslelf, just do:
(will be true for
DataGridViewCheckBoxCelland all subtypes)or
(will be true for
DataGridViewCheckBoxCellonly).