On my Windows Form I have a DataGridView component, which is bound to a BindingSource. The BindingSource is an object datasource to an EntityFramework object.
Some t
I actually don't know when this happens, but I tend to create all the columns manually. I create the columns in the designer and set the AutoGenerateColumns
property to false
in my code.
I had the same problem. I couldn't find the AutoGenerate property in my code.
For reasons I do not understand my DataGridView does not have an AutoGenerate property that I can see in my VB code.
I do not see a checkbox on the Edit Columns dialog box.
I do not see an AutoGenerate property in the grid's properties view.
I have Visual Studio Community 2017.
Here's my class properties:
Public Property BatchId As Integer
Public Property Code as String
Public Property Count As Integer
Public Property Description As String
Public Property Id As Integer
So, here's what I did:
When I ran my application the DataGridView displayed only those columns in my class.
Set AutoGenerateColumns property to False but keep remember do it just before databinding.
eg:
DataGridView1.AutoGenerateColumns=false;
DataGridView1.DataSource=getData();
By default it is set to True.
Try leave first of auto generated columns and set it visibility false. If it don't help try leave all them with Visible=false. Sorry for bad English.
Add this code or change your DataGridView Property AutoGenerateColumns
to false
DataGridView1.AutoGenerateColumns=false;