Click here to Skip to main content
15,905,508 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: the fast ways to create a list Pin
Eddy Vluggen11-Dec-18 6:39
professionalEddy Vluggen11-Dec-18 6:39 
QuestionFill Treeview using recursion Pin
sterenas7-Dec-18 10:15
sterenas7-Dec-18 10:15 
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 
You could add a level without changing the code; all that needs changing is the data (assuming you are still reading it from a DB as a table, instead of a hard-coded list I'm using for explanation)

VB
Dim data As List(Of Thingy) = New List(Of Thingy)
data.Add(New Thingy(1, "Shop 1", 0))
data.Add(New Thingy(2, "Shop 2", 0))

data.Add(New Thingy(11, "Uncategorized", 1)) ' both shops have uncategorized items
data.Add(New Thingy(21, "Uncategorized", 2))

data.Add(New Thingy(12, "Animals", 1))
data.Add(New Thingy(22, "Animals", 2))

data.Add(New Thingy(13, "Plants", 1))
data.Add(New Thingy(23, "Plants", 2))

data.Add(New Thingy(222, "Dogs", 22)) ' only shop 2 has dogs
data.Add(New Thingy(2221, "Small", 222))
data.Add(New Thingy(2222, "Medium", 222))
data.Add(New Thingy(2223, "Large", 222))

data.Add(New Thingy(131, "Trees", 13)) 'only shop 1 has trees
data.Add(New Thingy(132, "Flowers", 13))
data.Add(New Thingy(1321, "White", 132))
data.Add(New Thingy(1322, "Brown", 132))

data.Add(New Thingy(232, "Flowers", 23)) ' flowers for shop 2
data.Add(New Thingy(2321, "White", 232))
data.Add(New Thingy(2322, "Brown", 232))
If you want to add another level, just give it a new number and decide who is going to be the parent-item.

For example, if the White flowers would be divided into thorny and non-thorny, we'd add numbers similar to below;

VB
data.Add(New Thingy(23211, "Thorny", 2321))
data.Add(New Thingy(23212, "Non-thorny", 2321))
Graag gedaan Smile | :)

PS: you don't have to use the numbering-scheme like I did - as long as each item in the tree has a unique number, everything should work. So, numbering them 1,2,3,4,5 etc doesn't change it. Feel free to use a more friendly numbering Smile | :)
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 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 
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 

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.