Creating Tree Views in Code : TreeView « GUI « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » GUI » TreeView 
14.42.1.Creating Tree Views in Code
Creating Tree Views in Code
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms

public class TreeViewCreationInCode
   public Shared Sub Main
        Application.Run(New Form1)
   End Sub
End class

Public Class Form1
    Inherits System.Windows.Forms.Form

    Dim TreeView1 As TreeView

    Public Sub New()
        MyBase.New()

        Me.AutoScaleBaseSize = New System.Drawing.Size(513)
        Me.ClientSize = New System.Drawing.Size(292293)

        TreeView1 = New TreeView
        TreeView1.Location = New Point(75100)
        TreeView1.Size = New Size(150150)
        Controls.Add(TreeView1)
        TreeView1.Nodes.Clear()

        Dim RootNode = New TreeNode("Root")
        TreeView1.Nodes.Add(RootNode)
        TreeView1.Nodes(0).Nodes.Add(New TreeNode("Node 1"))

        For intLoopIndex As Integer = To 3
            TreeView1.Nodes(0).Nodes(0).Nodes.Add(New _
                TreeNode("Node" & Str(intLoopIndex)))
        Next intLoopIndex

        TreeView1.Nodes(0).Nodes.Add(New TreeNode("Node 4"))

        For intLoopIndex As Integer = To 6
            TreeView1.Nodes(0).Nodes(1).Nodes.Add(New _
                TreeNode("Node" & Str(intLoopIndex)))
        Next intLoopIndex

    End Sub

End Class
14.42.TreeView
14.42.1.Creating Tree Views in CodeCreating Tree Views in Code
14.42.2.Add and remove tree nodesAdd and remove tree nodes
14.42.3.Build file tree recursivelyBuild file tree recursively
14.42.4.Using a TreeView to display the directory structureUsing a TreeView to display the directory structure
14.42.5.Tree Node selection eventTree Node selection event
14.42.6.TreeView CheckBoxTreeView CheckBox
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.