2
I’m filling my Datagridview with a list of objects, but when I fill the grid for the first time it’s all right. When Seto the Datasource property is null, the grid columns are deleted.
There is the possibility to reset the Datasource property without deleting the header columns ?
Code snippet I use:
if (listVetObj.Count > 0)
{
dgvControle.DataSource = listVetObj;
dgvControle.Update();
dgvControle.Refresh();
txtQtdeLinhas.Text = dgvControle.RowCount.ToString();
txtQtdeLinhas.Refresh();
}
When resetting the property within a method the header columns are deleted:
Code:
private void LimparCampos()
{
dgvControle.DataSource = null;
dgvControle.Update();
dgvControle.Refresh();
}
The header columns you create before correct ?
– novic
These are fixed on the grid. When I insert line to line, for performance reasons, I started using list and setando direct in Datasource, there began this problem.
– Diego Farias