I have handled this a few different ways, hopefully this is helpful.
The first option, as Justin mentioned, is to set AutoGennerateColumns = false, and do it manually from there. If you bind it, the runtime will create columns for all of the public properties of Sample. If you want to remove them, you can do that with
DataGridView.Columns["SomePropertyOfSample"].Remove();
This solution is a bit problematic, as you need to keep it updated, and explicitly remove items.
Justin's Edit 2 option of setting the Browsable attribute to false on the property is interesting, I have not tried that before.
The solution that I have ended up using, and that I think works pretty well revolves around an interface.
I had two different DataGridViews that needed to show the same data, but showing and hiding different colums each time. In this case you would do:
public interface ISimpleSample
{
string Name {get;}
int ID {get;}
}
public interface IAdvancedSample
{
string Name {get; set;}
int ID {get; set;}
string Make {get; set;}
string Model {get; set;}
}
public class Sample : ISimpleSample, IAdvancedSample
{
//Implementation skipped
}
You then create your Sample collection using
BindingList<ISimpleSample> = new BindingList<ISimpleSample>();
and bind to that.
If you want to add columns later, you just add them to the appropriate interface.
This worked well for my project, let me know what you think.