Thursday, 21 January 2010

C# How to bind DataTable columns to DataGridView manually

image

dt = new DataTable();
dt.Columns.Add("Reference", typeof (string));
dt.Columns.Add("Version", typeof(string));
dt.Columns.Add("LatestVersion", typeof(string));
//5. Set AutogenerateColumns to false
dataGridView1.AutoGenerateColumns = false;
dataGridView1.DataSource = dt;

No comments:

Post a Comment