Just set DataGridView.AutoGenerateColumns = false
;
You need click on the arrow on top right corner (in datagridview
) to add columns, and in DataPropertyName
you need to put a name of your property in your class.
Then, after you defined your columns in datagridview
, you can set datagridview.datasource = myClassViewModel
.