namespace Sample
{
public partial class Form1 : Form
{
public static readonly string TABLE_NAME = "DEFAULT_TABLE";
protected DataSet m_csDataSet = new DataSet();
protected List m_csColNames = new List();
protected Dictionary headNames = new Dictionary();

public Form1()
{
InitializeComponent();

m_csColNames.Add("C1");
m_csColNames.Add("C2");
headNames.Add("C1", "AAAAAA");
headNames.Add("C2", "BBBBBB");
}

private void Form1_Load(object sender, EventArgs e)
{

DataTable csDataTable = new DataTable(TABLE_NAME);
foreach (string strColName in m_csColNames)
{
csDataTable.Columns.Add(strColName);
}
m_csDataSet.Tables.Add(csDataTable);

dataGridView1.DataSource = csDataTable;
foreach (string strColName in m_csColNames)
{
dataGridView1.Columns[strColName].HeaderText = headNames[strColName];
}
dataGridView1.EditMode = DataGridViewEditMode.EditProgrammatically;
dataGridView1.ReadOnly = true;
dataGridView1.RowHeadersVisible = false;
}

public string[] getValues(object csBean, List csOrderCols)
{
List csVals = new List();
Type csType = csBean.GetType();
foreach (string strColName in csOrderCols)
{
csVals.Add((string)csType.GetProperty(strColName).GetValue(csBean, null));
}
return csVals.ToArray();
}

private void button1_Click(object sender, EventArgs e)
{
List list = new List();
list.Add(new Bean("a1", "b5"));
list.Add(new Bean("a2", "b4"));
list.Add(new Bean("a3", "b3"));
list.Add(new Bean("a4", "b2"));
list.Add(new Bean("a5", "b1"));

foreach (Bean csBean in list)
{
m_csDataSet.Tables[TABLE_NAME].Rows.Add(getValues(csBean, m_csColNames));
}

}

public class Bean
{
public string C1 { get; set; }
public string C2 { get; set; }
public Bean(string c1, string c2)
{
C1 = c1;
C2 = c2;
}
}

}
}