Click here to Skip to main content
15,890,717 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Fill Treeview using recursion Pin
Eddy Vluggen8-Dec-18 0:12
professionalEddy Vluggen8-Dec-18 0:12 
AnswerRe: Fill Treeview using recursion Pin
Eddy Vluggen8-Dec-18 1:46
professionalEddy Vluggen8-Dec-18 1:46 
GeneralRe: Fill Treeview using recursion Pin
sterenas8-Dec-18 4:26
sterenas8-Dec-18 4:26 
GeneralRe: Fill Treeview using recursion Pin
Eddy Vluggen8-Dec-18 4:37
professionalEddy Vluggen8-Dec-18 4:37 
GeneralRe: Fill Treeview using recursion Pin
sterenas10-Dec-18 3:52
sterenas10-Dec-18 3:52 
GeneralRe: Fill Treeview using recursion Pin
Eddy Vluggen11-Dec-18 2:08
professionalEddy Vluggen11-Dec-18 2:08 
GeneralRe: Fill Treeview using recursion Pin
sterenas11-Dec-18 5:34
sterenas11-Dec-18 5:34 
GeneralRe: Fill Treeview using recursion Pin
Eddy Vluggen11-Dec-18 6:16
professionalEddy Vluggen11-Dec-18 6:16 
sterenas wrote:
You actually didn't add another level to the data.
AFAIK, I did; using the same code, we can also easily add the rootlevel called "shops", if you want the tree to start there. Simply take the code with the changes I proposed, and add the code below;

VB
Dim data As List(Of Thingy) = New List(Of Thingy)

data.Add(New Thingy(99999, "Shops", 0))
data.Add(New Thingy(1, "Shop 1", 99999))
data.Add(New Thingy(2, "Shop 2", 99999))
'  .. rest of the list remains the same
The tree will then have a single branch called shops, with a list of shops under that node, and categories of stuff to sell within that. I used a higher number for the lowest level to show that the numbers are only used to "link" the nodes together - the number in itself is meaningless.

sterenas wrote:
Public Class Thingy
I've used the thingy-class as a placeholder for the data; they're just nodes. When adding a level, all we need is three things:
* the Id of the node (what the treenode is called)
* the Id of the node that we're going display this one in (the parent node)
* a name to display (which does not have to be limited to categories)

If any node is clicked, you can traverse the tree to see which shop it belongs to.

sterenas wrote:
About to give up on this treeview and use a datagridview which is far simpler to understand Frown | :(
The choice between TreeView and GridView is determined by the data; if it is a tree, you use a tree, if it is a grid, you use the gridview. We don't do grids in trees or trees in grids, because that becomes complicated quickly.

Complicated code is frustrating, which leads to anger, which leads to the dark side.

sterenas wrote:
Ik zit vast met deze boom. Heel erg bedankt voor al je hulp Smile | :)
No problem, we all been stuck at some point Thumbs Up | :thumbsup:
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.

GeneralRe: Fill Treeview using recursion Pin
sterenas11-Dec-18 7:51
sterenas11-Dec-18 7:51 
GeneralRe: Fill Treeview using recursion Pin
Eddy Vluggen11-Dec-18 23:10
professionalEddy Vluggen11-Dec-18 23:10 
Questionentity framework Group by multiple columns and count the number of groups with more than 1 item Pin
desanti6-Dec-18 11:24
desanti6-Dec-18 11:24 
AnswerRe: entity framework Group by multiple columns and count the number of groups with more than 1 item Pin
Richard Deeming7-Dec-18 7:46
mveRichard Deeming7-Dec-18 7:46 
QuestionProblems with Entity Famework and bindingsources Pin
desanti6-Dec-18 0:13
desanti6-Dec-18 0:13 
QuestionDrawlines is correct or not ? Pin
Coffee_Break5-Dec-18 1:27
Coffee_Break5-Dec-18 1:27 
AnswerRe: Drawlines is correct or not ? Pin
Eddy Vluggen5-Dec-18 2:05
professionalEddy Vluggen5-Dec-18 2:05 
Questionsave my excel invoice in excel sheet Pin
kami1244-Dec-18 8:04
kami1244-Dec-18 8:04 
QuestionRe: save my excel invoice in excel sheet Pin
Richard MacCutchan4-Dec-18 8:58
mveRichard MacCutchan4-Dec-18 8:58 
QuestionError ContextSwitchDeadlock Pin
desanti4-Dec-18 5:33
desanti4-Dec-18 5:33 
AnswerRe: Error ContextSwitchDeadlock Pin
Eddy Vluggen4-Dec-18 6:33
professionalEddy Vluggen4-Dec-18 6:33 
GeneralRe: Error ContextSwitchDeadlock Pin
desanti4-Dec-18 8:45
desanti4-Dec-18 8:45 
GeneralRe: Error ContextSwitchDeadlock Pin
Eddy Vluggen4-Dec-18 9:37
professionalEddy Vluggen4-Dec-18 9:37 
GeneralRe: Error ContextSwitchDeadlock Pin
desanti5-Dec-18 1:18
desanti5-Dec-18 1:18 
GeneralRe: Error ContextSwitchDeadlock Pin
Eddy Vluggen5-Dec-18 1:43
professionalEddy Vluggen5-Dec-18 1:43 
GeneralRe: Error ContextSwitchDeadlock Pin
desanti5-Dec-18 2:08
desanti5-Dec-18 2:08 
GeneralRe: Error ContextSwitchDeadlock Pin
Eddy Vluggen5-Dec-18 2:37
professionalEddy Vluggen5-Dec-18 2:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.