I am trying to bind a DataGridView to a List, where MyObject looks like
class MyObject
{
public string Property1 { get; set; }
public string Property2 { get; set; }
}
//List<MyObject> objects;
grid.Columns[0].DataPropertyName = "Property1";
grid.DataSource = objects;
I want only one property to be displayed, but instead I get another column added to my DataGridView where the Property2 is also displayed. How can I prevent it from being added?