开发者

how to get datagridView display content of list rather than just length

开发者 https://www.devze.com 2023-01-16 16:35 出处:网络
ListA = new List(); A.Add(\"Apple\"); A.Add(\"Banana\"); A.Add(\"Pineapple\"); dataGridView.DataSource = a;

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 datagri开发者_JAVA技巧dView to display string instead of length.


Try using a List to actually take the string values rather than representing them by the char[].Count();

For example:

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

dataGridView.ItemSource = A;
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号