
Public Class ClassNodes
    Public Shared MyTreeView As TreeView
    Public Shared Datatable_Nodes As DataTable
    Public Shared TREEVIEW_IMAGELIST As ImageList
    Public Shared Function Return_Node(PARENT_ID As Integer, ParentNode As TreeNode)
        Dim expression As String
        expression = "PARENT_GUID = " & PARENT_ID 'Einschränkung auf Type  und Parent_Guid
        Dim foundRows() As DataRow
        foundRows = Datatable_Nodes.Select(expression)
        Dim q As Integer
        For q = 0 To foundRows.GetUpperBound(0)
            Dim ID9 = foundRows(q)("GUID")
            Dim LevelEntity9 = foundRows(q)("ENTITY_ID")
            Dim controlID9 = foundRows(q)("CONTROL_ID")
            Dim nodetext9 = foundRows(q)("NODE_CAPTION")
            Dim RECORD_ID = foundRows(q)("RECORD_ID")
            Dim NODE_CONFIG_ID = foundRows(q)("NODE_CONFIG_ID")
            ' Node erstellen..
            Dim NEW_NODE As TreeNode
            NEW_NODE = New TreeNode(nodetext9)
            ClassNodeNavigation.Check_NODE_CONFIG_ID(LevelEntity9)
            NEW_NODE.Tag = ClassNodeNavigation.CreateNODE_TAG(LevelEntity9, ID9, RECORD_ID, NODE_CONFIG_ID)

            Dim index = 0
            For Each img As String In TREEVIEW_IMAGELIST.Images.Keys
                If img.Replace("LEVEL#ENTITY", "") = "6" & LevelEntity9.ToString Then
                    Exit For
                End If
                index += 1
            Next
            NEW_NODE.ImageIndex = index
            NEW_NODE.SelectedImageIndex = index
            ' ..und einfügen
            ParentNode.Nodes.Add(NEW_NODE)
        Next '
    End Function
End Class
