I have a datagridview
that is bound to a dataset
via a table adaptor
which in turn linked to a SQL table.
I want to change the cell type of the status and priority columns to comboboxes.
I have tried this:
private void dgvFechas_ColumnAdded(object sender, DataGridViewColumnEventArgs e)
{
try
{
if (e.Column.ValueType == typeof(TextBox) && (e.Column.Index == 5) || (e.Column.Index == 6))
{
e.Column.CellTemplate = new DataGridViewComboBoxCell();
}
}
catch (Exception ex) { }
}
but it doesnt seem like the event handler fires when the program starts up.
So im not too sure how i can get it to work.
I followed this guide which allowed me change the cell type:
After doing this i got a data_error which i fixed by ignoring the data error event. I know that isnt really the correct way of doing things, but it works for me.
private void dataGridView1_DataError(object sender, DataGridViewDataErrorEventArgs e)
{
//ignore
}