DataGridView - I need a simple example that works with List<?>
Hello,
I'm hoping someone can help me out here.
I want to get started using DataGridView, but I've not actually managed to find any examples that fit what I'm trying to do.
What I want to do is very simple:
(1) I have a list of class instances thus:
classList.Add(new MyClass("Fred"));List<MyClass> classList = new List<MyClass>();
classList.Add(new MyClass("Wilma"));
(2) I want eachMyClassmember ofclassListto be represented as a row in my DataGridView
(3) I want to show only a subset of the class parameters, for example:
// Want to show this in the interface // I DON'T want to show this in the interfacepublic class MyClass
{
private string name;
private int anumber;
public String Name
{
get { return (name); }
set { name = value; }
}
public int Number
{
get { return (anumber); }
set { anumber= value; }
}
}
I think that sums it up. No SQL, nothing just a nice list of data that I want to display.
Can anyone help? Many thanks. I've attempted to find what I want from the FAQ, but I'm finding it hard to see the wood for the trees.. If I had a small example, I think I'd be better placed to understand what I need.
Many thanks!

