ColumnCount in DataGridView remains 0 after assigning data source
Posted
by
Manan Shah
on Stack Overflow
See other posts from Stack Overflow
or by Manan Shah
Published on 2012-06-04T10:37:06Z
Indexed on
2012/06/04
10:40 UTC
Read the original article
Hit count: 288
c#-4.0
|datagridview
I am having trouble with the following simple code
List<Car> tempList = new List<Car>();
BindingSource bindingSource = new BindingSource();
bindingSource.DataSource = tempList;
dgTempView.DataSource = bindingSource;
Here, dgTempView is a data grid view After the above lines execute, the column count in the datagrid view remains 0. And when I try adding a Car instance in tempList, I get an error saying that 'no row can be added to a datagridview control that does not have columns' . I am not able to understand what am I missing here
© Stack Overflow or respective owner