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;

Comments

Popular posts from this blog

Parse XML to dynamic object in C#

C# Crop white space from around the image