I am currently using a treeview control from Treeview Control from JKP. Trying to populate the tree with hierarchical data from an Excel Sheet, I encountered this problem: the tree I populated does not reflect the data. In this picture <code style="margin: 0px; padding: 1px 5px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: pre-wrap; background-color: rgb(238, 238, 238);">AP0004</code> should be under <code style="margin: 0px; padding: 1px 5px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: pre-wrap; background-color: rgb(238, 238, 238);">TP0002
</code>
The code I've tried is this
There must be something wrong with my approach here. Any suggestion? Thanks a lot.
</code>
The code I've tried is this
Code:
[/FONT]<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;">[COLOR=#00008B]For[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00008B]Each[/COLOR][COLOR=#000000] c [/COLOR][COLOR=#00008B]In[/COLOR][COLOR=#000000] Sheet14[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Range[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]"A2:A"[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000000]&[/COLOR][COLOR=#000000] Sheet14[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Range[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]"A"[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000000]&[/COLOR][COLOR=#000000] Rows[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Count[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#00008B]End[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]xlUp[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Row[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]On[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00008B]Error[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00008B]Resume[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00008B]Next[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#808080]'Populate level 1[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]Set[/COLOR][COLOR=#000000] cRoot [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]AddRoot[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]sKey[/COLOR][COLOR=#000000]:=[/COLOR][COLOR=#000000]c[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Value2[/COLOR][COLOR=#000000],[/COLOR][COLOR=#000000] vCaption[/COLOR][COLOR=#000000]:=[/COLOR][COLOR=#000000]c[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Value2[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]Set[/COLOR][COLOR=#000000] cExtraNode [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] cRoot[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]AddChild[/COLOR][COLOR=#000000]([/COLOR][COLOR=#800000]"ML_"[/COLOR][COLOR=#000000] [/COLOR][COLOR=#000000]&[/COLOR][COLOR=#000000] c[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Value2[/COLOR][COLOR=#000000],[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]"Meilensteine"[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#808080]'Populate level 2[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]Set[/COLOR][COLOR=#000000] cNode [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] cRoot[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]AddChild[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]c[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Offset[/COLOR][COLOR=#000000](,[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]1[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Value2[/COLOR][COLOR=#000000],[/COLOR][COLOR=#000000] c[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Offset[/COLOR][COLOR=#000000](,[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]1[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Value2[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#808080]'Populate level 3[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]If[/COLOR][COLOR=#000000] cNode[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Level [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]2[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00008B]Then[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00008B]Set[/COLOR][COLOR=#000000] cNode [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] cNode[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]ParentNode
[/COLOR][COLOR=#00008B]If[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00008B]Not[/COLOR][COLOR=#000000] IsEmpty[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]c[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Offset[/COLOR][COLOR=#000000](,[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]2[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Value2[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00008B]Then[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]Set[/COLOR][COLOR=#000000] cNode [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] cNode[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]AddChild[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]c[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Offset[/COLOR][COLOR=#000000](,[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]2[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Value2[/COLOR][COLOR=#000000],[/COLOR][COLOR=#000000] c[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Offset[/COLOR][COLOR=#000000](,[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]2[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Value2[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]End[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00008B]If[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#808080]'Populate level 4[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]If[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00008B]Not[/COLOR][COLOR=#000000] IsEmpty[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]c[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Offset[/COLOR][COLOR=#000000](,[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]3[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Value2[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00008B]Then[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]If[/COLOR][COLOR=#000000] cNode[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Level [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]2[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00008B]Then[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]Set[/COLOR][COLOR=#000000] cNode [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] cNode[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]AddChild[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]c[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Offset[/COLOR][COLOR=#000000](,[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]3[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Value2[/COLOR][COLOR=#000000],[/COLOR][COLOR=#000000] c[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Offset[/COLOR][COLOR=#000000](,[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]3[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Value2[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]Set[/COLOR][COLOR=#000000] cNode [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] cNode[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]ParentNode
[/COLOR][COLOR=#00008B]ElseIf[/COLOR][COLOR=#000000] cNode[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Level [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]1[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00008B]Then[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]Set[/COLOR][COLOR=#000000] cNode [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] cNode[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Child[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]AddChild[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]c[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Offset[/COLOR][COLOR=#000000](,[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]2[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Value2[/COLOR][COLOR=#000000],[/COLOR][COLOR=#000000] c[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Offset[/COLOR][COLOR=#000000](,[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]2[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Value2[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]Set[/COLOR][COLOR=#000000] cNode [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] cNode[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Child[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]AddChild[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]c[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Offset[/COLOR][COLOR=#000000](,[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]3[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Value2[/COLOR][COLOR=#000000],[/COLOR][COLOR=#000000] c[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]Offset[/COLOR][COLOR=#000000](,[/COLOR][COLOR=#000000] [/COLOR][COLOR=#800000]3[/COLOR][COLOR=#000000]).[/COLOR][COLOR=#000000]Value2[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]Set[/COLOR][COLOR=#000000] cNode [/COLOR][COLOR=#000000]=[/COLOR][COLOR=#000000] cNode[/COLOR][COLOR=#000000].[/COLOR][COLOR=#000000]ParentNode
[/COLOR][COLOR=#00008B]End[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00008B]If[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]End[/COLOR][COLOR=#000000] [/COLOR][COLOR=#00008B]If[/COLOR][COLOR=#000000]
[/COLOR][COLOR=#00008B]Next[/COLOR]</code>[FONT=Arial]
There must be something wrong with my approach here. Any suggestion? Thanks a lot.