TreeView Control.

Slides:



Advertisements
Similar presentations
Creating Custom Controls ISYS 512/812. Inheritance The process in which a new class can be based on an existing class, and will inherit that class’s interface.
Advertisements

Common Windows Controls. Objectives Learn about common Windows controls Load, display, and share images with other control instances using the ImageList.
Compunet Corporation Programming with Visual Studio.NET GUI Week 13 Tariq Aziz and Kevin Jones.
Visual Studio 2005 Using the DataGridView Control V. Matos Cleveland State University.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
Multiple Forms & Procedures. Form Methods: –Show, Hide, Activate, Close Events: –Load, Activated, Closing, Closed.
More on lists, exceptions, loops and validation. You can use the exception to indicate the error that occurred Private Sub btnCheck_Click(ByVal sender.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
Chapter 13: Advanced GUI and Graphics
1 Multiple Document Interface (MDI) Windows. Single Document Interface (SDI) A program that can only support one open window or a document For Example,
XML Web Services Tuc Goodwin 8/10/ Agenda Review: What is an XML Web Service? Review Steps to calling a Web Service SharePoint Web Services.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Directory and File. Access Files in a Directory Name space: System.IO The Directory and File classes contain only shared methods that set or return information.
Printer & Dialog boxes Engr. Faisal ur Rehman CE-105T Spring 2007.
Menus,MonthCalender, DateTimePicker, MDI,Tree View, List View,
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 4 I Need a Tour Guide.
Lecture 8 Visual Basic (2).
1 CC111 Lec9 : Visual Basic Visual Basic (3) Lecture 9.
VB Procedures. Procedures. Sub procedure: Private/Public Sub SubName(Arguments) … End Sub Private: Can only be accessed by procedures in the same form.
Visual Basic.NET Windows Forms Hello World Homework Assignment.
Microsoft Visual Basic 2008 CHAPTER TWELVE Cell Phone Applications and Web Services.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Unit 3: Adding Code to a Microsoft ASP.NET Web Form.
COM148X1 Interactive Programming Lecture 7. Topics Today HCI Event Handling.
CIS 338: Classes and Modules Dr. Ralph D. Westfall May, 2011.
CS0004: Introduction to Programming Project 1 – Lessons Learned.
ADO.NET Objects – Data Providers Dr. Ron Eaglin. Requirements Visual Studio 2005 Microsoft SQL Server 2000 or 2005 –Adventure Works Database Installed.
6c – Function Procedures Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Visual Basic.NET Programming March 3, Agenda Questions / Discussion Cookies Project Work (Ends Around 9:00 PM) Demo's (15 minutes per team)
HNDIT Rapid Application Development
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java.
1 CS387/CS587: Note04 Lab 3. 2 Master Page All Web pages will be similar Should be created before other web pages Add New Items Controls on the Master.
Using ADO.Net to Build a Login System Dr. Ron Eaglin.
XML Web Services Tuc Goodwin 2/9/ Agenda What is an XML Web Service? Web Services Business Benefits Changing Application Architectural Model Web.
ADO.NET Objects Data Adapters Dr. Ron Eaglin. Agenda Builds on Information in Part I Should have working knowledge of creating a database connection Continuation.
TREES General trees Binary trees Binary search trees AVL trees Balanced and Threaded trees.
Introduction to VB programming Dr. John P. Abraham UTPA Chapters 2 & 3.
Files and Streams. What is a file? Up until now, any stored data within a program is lost when the program closes. A file is a permanent way to store.
Graphical User Interfaces Part 2 1 Outline TreeViews ListViews Tab Control.
18-1 Chapter 18 Binary Trees Data Structures and Design in Java © Rick Mercer.
These materials where developed by Martin Schray. Please feel free to use and modify them for non-commercial purposes. If you find them useful or would.
Visual Basic Declaring Variables Dim x as Integer = 0 In the statement above, x is being declared as an Integer (whole number) and is initialised.
Computer Science Up Down Controls, Decisions and Random Numbers.
Directory and File. Access Files in a Directory Name space: System.IO The Directory and File classes contain only shared methods that set or return information.
Data Types. Visual Basic provides data type Single for storing single-precision floating-point numbers. Data type Double requires more memory to store.
Sub Procedures And Functions
Apply Procedures to Develop Menus, List Box and Combo Box Objects
2: Exceptions and User Interfaces
Chapter 9 S. NandaGopalan, BIT
Apply Procedures to Develop Message, Input, and Dialog Boxes
Binary Trees "The best time to plant a tree is twenty years ago. The second best time is now." -Chinese proverb Real programmmers always confuse Christmas.
Apply Procedures to Develop Menus, List Box and Combo Box Objects
Introduction to VB programming
Files and Streams.
TREES General trees Binary trees Binary search trees AVL trees
للمزيد زورونا على موقعنا الإلكتروني:
Boolean Expressions and If statements
Windows Forms GUI: A Deeper Look
1.الدوال Function 2.الاجراءاتSub Procedure 3.وحده نمطيه Add Module
CIS16 Application Development and Programming using Visual Basic.net
Input and Output.
XML Kunwar Singh.
ASP.NET Relationships between tables
Database Handling Class and Service
Input and Output.
CIS 338: Images on Forms Dr. Ralph D. Westfall May, 2009.
Files and Streams.
Input and Output Chapter 3.5
GUI Programming in Visual Studio .NET
Web Service.
Presentation transcript:

TreeView Control

TreeView Control Drill Down interface Displays information in a hierarchical manner. Nodes collection: Root: No parent Other nodes have a single parent. Siblings: Children have the same parent. First Sibling, Last Sibling TreeNode Editor

TreeView Properties TopNode Nodes GetNodeCount(False) SelectedNode Nodes(Index) GetNodeCount(False) SelectedNode FullPath

Display Root Node’s Children Dim TrNode As TreeNode For Each TrNode In TreeView1.TopNode.Nodes MessageBox.Show(TrNode.Text) MessageBox.Show(TrNode.FullPath) Nextree Note: Nodes is a collection of children nodes directly belong to a parent node.

Displaying Selected Node’s Information Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect MessageBox.Show(TreeView1.SelectedNode.Text) MessageBox.Show(TreeView1.SelectedNode.FullPath()) End Sub

Adding a TreeNode Programmatically Nodes collection’s Add method: Add(string) TreeView1.Nodes.Add("Root") Add(a tree node) Define a tree node object Dim myNode As New TreeNode() myNode.Text = "Root" TreeView1.Nodes.Add(myNode)

TreeView1.Nodes.Add("Root") TreeView1.Nodes(0).Nodes.Add("Child1") TreeView1.Nodes(0).Nodes.Add("Child2") TreeView1.Nodes(0).Nodes.Add("child3") TreeView1.Nodes(0).Nodes(0).Nodes.Add("GrandC11") TreeView1.Nodes(0).Nodes(0).Nodes.Add("GrandC12") TreeView1.Nodes(0).Nodes(1).Nodes.Add("GrandC21") TreeView1.Nodes(0).Nodes(2).Nodes.Add("GrandC31") TreeView1.Nodes(0).Nodes(2).Nodes.Add("GrandC32") TreeView1.Nodes(0).Nodes(2).Nodes(0).Nodes.Add("GGrandC311")

Recursive Procedure A procedure that calls itself.

Creating a TreeView of Directories Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim DiskDrive As String = "C:\" TreeView1.Nodes.Add(DiskDrive) Call GetFolders(TreeView1.Nodes(0)) End Sub Private Sub GetFolders(ByVal CurrentFolder As TreeNode) Dim FolderPath As String FolderPath = CurrentFolder.Text Dim folder As String If Directory.GetDirectories(FolderPath).Length <> 0 Then For Each folder In Directory.GetDirectories(FolderPath) Dim newNode As New TreeNode(folder) CurrentFolder.Nodes.Add(newNode) Call GetFolders(newNode) Next End If

Displaying Files in Selected Folder Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect Dim currDir As String currDir = TreeView1.SelectedNode.Text Dim fName As String ListBox1.Items.Clear() For Each fName In Directory.GetFiles(currDir) ListBox1.Items.Add(fName) Next End Sub