Click here to Skip to main content
15,923,389 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Threading, Invoke, Delegate and MethodInvoker... Pin
Eddy Vluggen23-Dec-18 11:14
professionalEddy Vluggen23-Dec-18 11:14 
QuestionVB Client server with timer Pin
Member 1409761321-Dec-18 21:49
Member 1409761321-Dec-18 21:49 
AnswerRe: VB Client server with timer Pin
Richard MacCutchan21-Dec-18 22:00
mveRichard MacCutchan21-Dec-18 22:00 
GeneralRe: VB Client server with timer Pin
Member 1409761321-Dec-18 22:16
Member 1409761321-Dec-18 22:16 
AnswerRe: VB Client server with timer Pin
Dave Kreskowiak22-Dec-18 4:12
mveDave Kreskowiak22-Dec-18 4:12 
QuestionHow to get a list of installed applications and uninstall them ? Pin
Lucifer Morningstar19-Dec-18 22:59
Lucifer Morningstar19-Dec-18 22:59 
SuggestionRe: How to get a list of installed applications and uninstall them ? Pin
CHill6019-Dec-18 23:07
mveCHill6019-Dec-18 23:07 
AnswerRe: How to get a list of installed applications and uninstall them ? Pin
Richard MacCutchan19-Dec-18 23:22
mveRichard MacCutchan19-Dec-18 23:22 
AnswerRe: How to get a list of installed applications and uninstall them ? Pin
Eddy Vluggen20-Dec-18 0:39
professionalEddy Vluggen20-Dec-18 0:39 
QuestionTrying to create a search query that will bring the results searched in access database. It is bringing up an error runtime error '3075' Pin
Member 1409033914-Dec-18 22:07
Member 1409033914-Dec-18 22:07 
AnswerRe: Trying to create a search query that will bring the results searched in access database. It is bringing up an error runtime error '3075' Pin
Richard MacCutchan14-Dec-18 22:51
mveRichard MacCutchan14-Dec-18 22:51 
GeneralRe: Trying to create a search query that will bring the results searched in access database. It is bringing up an error runtime error '3075' Pin
Member 1409033915-Dec-18 5:22
Member 1409033915-Dec-18 5:22 
AnswerRe: Trying to create a search query that will bring the results searched in access database. It is bringing up an error runtime error '3075' Pin
Dave Kreskowiak15-Dec-18 5:16
mveDave Kreskowiak15-Dec-18 5:16 
QuestionHow to assign enter key? Pin
Member 1408751912-Dec-18 20:07
Member 1408751912-Dec-18 20:07 
AnswerRe: How to assign enter key? Pin
Richard MacCutchan12-Dec-18 22:00
mveRichard MacCutchan12-Dec-18 22:00 
Questionthe fast ways to create a list Pin
desanti11-Dec-18 4:36
desanti11-Dec-18 4:36 
AnswerRe: the fast ways to create a list Pin
Richard Deeming11-Dec-18 5:30
mveRichard Deeming11-Dec-18 5:30 
GeneralRe: the fast ways to create a list Pin
desanti11-Dec-18 5:40
desanti11-Dec-18 5:40 
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 
Hi Eddie,
Realized I need to add an extra level to the tree. Changed your code to add the ShopName to the list of Thingy. Did a For Each to add all shop names to the tree as a first stage (there's only a max of 10 anyway).
I then tried to first filter the tree by ShopName to then add the nodes according to your code, but I can't seem to figure it out. I think possibleParent tv.Nodes.Find is not taking into account my possibleShop tv.nodes.find ?
Would you have any suggestions on this one ?
Dank U Wel Smile | :)

VB
Dim data As List(Of Thingy) = New List(Of Thingy) From {
    New Thingy("SHOP 1", 15, "Uncategorized", 0),
    New Thingy("SHOP 1", 50, "Animals", 0),
    New Thingy("SHOP 1", 51, "Plants", 0),
    New Thingy("SHOP 1", 52, "Dogs", 50),
    New Thingy("SHOP 1", 53, "Small", 52),
    New Thingy("SHOP 1", 54, "Medium", 52),
    New Thingy("SHOP 1", 55, "Large", 52),
    New Thingy("SHOP 1", 56, "Trees", 51),
    New Thingy("SHOP 1", 57, "Flowers", 51),
    New Thingy("SHOP 1", 58, "White", 55),
    New Thingy("SHOP 1", 59, "Brown", 55),
    New Thingy("SHOP 2", 15, "Uncategorized", 0),
    New Thingy("SHOP 2", 50, "Animals", 0),
    New Thingy("SHOP 2", 51, "Plants", 0),
    New Thingy("SHOP 2", 52, "Dogs", 50),
    New Thingy("SHOP 2", 53, "Small", 52),
    New Thingy("SHOP 2", 54, "Medium", 52),
    New Thingy("SHOP 2", 55, "Large", 52),
    New Thingy("SHOP 2", 56, "Trees", 51),
    New Thingy("SHOP 2", 57, "Flowers", 51),
    New Thingy("SHOP 2", 58, "White", 55),
    New Thingy("SHOP 2", 59, "Brown", 55)
}

' Add all shops to the tree
For Each item As Thingy In data
    Dim possibleShop As TreeNode() = tv.Nodes.Find(item.ShopName, searchAllChildren:=True)
    If possibleShop.Count = 0 Then
        tv.Nodes.Add(key:=item.ShopName, text:=item.ShopName)
    End If
Next

For Each item As Thingy In data
    Dim possibleShop As TreeNode() = tv.Nodes.Find(item.ShopName, searchAllChildren:=True)
    If possibleShop.Count > 0 Then
        Dim possibleParent As TreeNode() = tv.Nodes.Find(item.ParentCategory, searchAllChildren:=True)
        If possibleParent.Count = 0 Then
            tv.Nodes.Add(key:=item.IdCategory, text:=item.CategoryName)
        Else
            possibleParent.First().Nodes.Add(key:=item.IdCategory, text:=item.CategoryName)
        End If
    End If
Next

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.