I have a DataGridView and I need to add custom objects to it. Consider the following code:
DataGridView grid = new DataGridView();
grid.DataSource = objects
The easiest is that you add the "System.ComponentModel.Browsable" attributes to your DataModel:
public class TheDataModel
{
[System.ComponentModel.Browsable(false)]
public virtual int ID { get; protected set; }
public virtual string FileName { get; set; }
[System.ComponentModel.Browsable(false)]
public virtual string ColumnNotShown1 { get; set; }
[System.ComponentModel.Browsable(false)]
public virtual string ColumnNotShown2 { get; set; }
}