c# - Inserting nodes from DataGridView into a TreeView -
i don't know how manage correctly have ask here. have code:
(int = 0; < cusids.count; i++) { treenode node = new treenode(cusids[i]); treeview1.nodes.add(node); }
cusids list customer ids stored once (distinct - taken datagridview). have datatable called dtfoundids stores every single row datagridview ids appear in list above prresent (in datagridview customer id cann appear multiple times). code above creates nodes tree customer ids. wanted add type numbers each id listed in datagridview. records in datagridview like:
cusid |typenum ------------------ 111 | 234 111 | 211 122 | 123 122 | 556 122 | 222
so how can fill type numbers child nodes ids? want have 1 node every id , type numbers childnodes. thank much!
you can use node.imagekey
or node.name
, pass value on it
treenode node = new treenode(); node.imagekey = convert.tostring(cusids.rows[i]["cusid"]); node.name = convert.tostring(cusids.rows[i]["typenum"]);