【发布时间】:2012-07-02 02:18:22
【问题描述】:
我在数据库 ItemList 中有一个包含 ProdutID 和 ItemID 的表。
ProductID ItemID
AAA 1001
AAA 1002
AAA 1003
BBB 1201
BBB 1293
CCC 1040
DDD 2011
DDD 3203
我想像这样将所有这些数据添加到 Treeview:
+AAA
- 1001
- 1002
- 1003
+BBB
- 1201
- 1293
+CCC
- 1040
+DDD
- 2011
- 3203
请教我怎么做。谢谢。
编辑:
我尝试将长度为 2 的数据(ProductID,ItemID)的每个项目添加到 ArrayList 中
for(int i=0;i<arrayList.count;i++)
{
TreeNode treeNode = new TreeNode(((string[])arrayList[i])[0]);
treeview1.Nodes.Add(treeNode);
}
【问题讨论】:
-
您需要什么帮助?你试过什么?
-
@JonathonReinhart 目前我试图在 ArrayList 中添加所有项目。然后 for (int i= 0;i
-
最好在提供更多信息时编辑您的问题。代码不在 cmets 中。
-
@MahmoudGamal 我们不再使用它,目的不是阻碍人们的问题。见这里:meta.stackexchange.com/questions/137795/stack-overflow-is