Hi, I am new to C# and need a bit of guidence. I have a datgridview control which is populated by a binding source. I would like one of my columns to be a comboboxcell so after the grid is populated I have loop for the column I wish to change and set this :
public Boolean prSetColType(String pColName)
{
if (pColName == "TITLE")
{
DataGridViewColumn strCol = grdHeather.Columns [pColName];
DataGridViewComboBoxCell cellstyle = new DataGridViewComboBoxCell();
strCol.CellTemplate = cellstyle;
return true;
}
else
{
return false;
}
}
But it falls over on line :strCol.CellTemplate = cellstyle;
with error message must be derived from DataGridViewTextBoxCell.
Can anyone help please
public Boolean prSetColType(String pColName)
{
if (pColName == "TITLE")
{
DataGridViewColumn strCol = grdHeather.Columns [pColName];
DataGridViewComboBoxCell cellstyle = new DataGridViewComboBoxCell();
strCol.CellTemplate = cellstyle;
return true;
}
else
{
return false;
}
}
But it falls over on line :strCol.CellTemplate = cellstyle;
with error message must be derived from DataGridViewTextBoxCell.
Can anyone help please