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

Visual Basic

 
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 
Something like below would work Smile | :)
VB
Public Class Form1

    Public Class Thingy
        Sub New(id As Long, catName As String, parentId As Long)
            IdCategory = id
            CategoryName = catName
            ParentCategory = parentId
        End Sub
        Public IdCategory As Long
        Public CategoryName As String
        Public ParentCategory As Long
    End Class

    Sub New()

        ' This call is required by the designer. Without it, designer will be sad.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        Dim data As List(Of Thingy) = New List(Of Thingy)
        data.Add(New Thingy(15, "Uncategorized", 0))
        data.Add(New Thingy(50, "Animals", 0))
        data.Add(New Thingy(51, "Plants", 0))
        data.Add(New Thingy(52, "Dogs", 50))
        data.Add(New Thingy(53, "Small", 52))
        data.Add(New Thingy(54, "Medium", 52))
        data.Add(New Thingy(55, "Large", 52))
        data.Add(New Thingy(56, "Trees", 51))
        data.Add(New Thingy(57, "Flowers", 51))
        data.Add(New Thingy(58, "White", 55))
        data.Add(New Thingy(59, "Brown", 55))

        Dim tv As New TreeView
        tv.Dock = DockStyle.Fill
        Me.Controls.Add(tv)

        For Each item As Thingy In data
            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
        Next

    End Sub

End Class

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
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 
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 

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.