views:

21

answers:

1

List A = new List();
A.Add("Apple");
A.Add("Banana");
A.Add("Pineapple");

dataGridView.DataSource = a;

Result: is the length of each item in the list rather than Item itself.
5
6
9
How can I make datagridView to display string instead of length.

A: 

It should be as simple as you say, you just have to make sure your datagridview has AutoGenerateColumns=true or you have the correct databound item inside the column block in the dataGridView on the form.

List<string> A = new List<string>(){"Apple","Banana","Pineapple"};
dataGridView.DataSource = A;
dataGridView.DataBind();
EJC