Treeview and Listview Controls - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Treeview and Listview Controls

Description:

There are many controls you can use to create professional software applications ... Determines whether scroll bars should automatically appear if the form's ... – PowerPoint PPT presentation

Number of Views:847
Avg rating:3.0/5.0
Slides: 17
Provided by: Dave6
Category:

less

Transcript and Presenter's Notes

Title: Treeview and Listview Controls


1
Treeview and Listview Controls
  • Tonga Institute of Higher Education

2
Treeview Control
Parent of Students And Staff Nodes
  • There are many controls you can use to create
    professional software applications
  • Form
  • Label
  • LinkLabel
  • TextBox
  • Etc.
  • A treeview control is useful as showing data in a
    tree
  • Use tvw as a prefix treeviews
  • Example tvwMinistryOfEducation

Nodes
Roots
Children of Tutors Node
3
Treeview Properties
  • BackColor
  • Determines the background color of the form
  • BorderStyle
  • Determines the style of the border
  • None
  • FixedSingle
  • Fixed3D
  • CheckBoxes
  • Determines whether a checkbox is displayed for
    each node
  • Enabled
  • Determines whether the user can use the control
  • Font
  • Determines the font of the text displayed
  • FullRowSelect
  • Determines whether a full row can be selected
  • There is a bug where it wont work if ShowLines
    and ShowPlusMinus are true
  • HideSelection
  • Removes the highlight from the selected node when
    control doesnt have focus
  • Location
  • Scrollable
  • Determines whether scroll bars should
    automatically appear if the forms contents use
    more space than the size of the form
  • ShowLines
  • Determines whether lines are displayed
  • ShowPlusMinus
  • Determines whether plus/minus is displayed
  • ShowRootLines
  • Determines whether root lines are displayed
  • Size
  • Determines the current size of the form
  • Sorted
  • Determines whether the nodes are sorted
  • TabIndex
  • Determines the index of the Tab order that this
    control will occupy
  • TabStop
  • Determines whether the tab order will stop at
    this control
  • Visible
  • Determines the visibility of the control
  • Anchor

4
Adding Nodes through the Properties Window
  • Click on Nodes in the properties window. A
    button with 3 periods is displayed
  • Click on the button with 3 periods
  • The Treenode Editor window is displayed

5
Demonstration
  • Changing Nodes through the Treeview Editor Window

6
TreeNode Object
  • Each node is a TreeNode object
  • The TreeNode object has many properties and
    methods
  • Checked
  • Collapse
  • Expand
  • IsSelected
  • IsVisible
  • NextNode
  • Parent
  • PrevNode
  • Remove
  • Text
  • And others

7
TreeNodeCollection Object
  • A collection of TreeNodes is a TreeNodeCollection
    object
  • The TreeNodeCollection object has many properties
    and methods
  • Clear
  • Remove
  • And Others

8
Selecting a Node
  • To select a node, we must find the location of
    the node
  • tvwMain.SelectedNode tvwMain.Nodes(0).Nodes(1)

Nodes represents a TreeNodeCollection
Each level uses Nodes
Node Index starts from 0
The location of the node
Property allows selected node to be changed
9
Controlling Treeviews with Code
TreeNodeCollection object controls the
collection of nodes
  • Adding Nodes
  • tvwMinistryOfEducation.Nodes.Add("New Root")
  • Deleting Nodes
  • tvwMinistryOfEducation.Nodes(0).Remove()

Text inside of new node
Control name
Method to add node
Finds a TreeNode object
Control name
Method to Delete node
10
Demonstration
  • Working with Treeviews through Code

11
ListView Control
  • Listviews allow users to display data in a table
  • The properties are covered in IT142

12
ListViewItem Object
  • Each row is a ListViewItem object
  • The ListViewItem object has many properties and
    methods
  • Remove
  • Selected
  • And others
  • To access a ListViewItem, find the location of
    the ListViewItem

ListViewItem
13
ListViewItemCollection Object
  • A collection of ListViewItems is a
    ListViewItemCollection object
  • The ListViewItemCollection object has many
    properties and methods
  • Add
  • Clear
  • And Others

14
Highlighting ListViewItems with Code
  • lvwActivity2.Items(1).Selected True

Property to Select item
The location of the ListViewItem
15
Adding ListViewItems with Code
We must add strings to subitems
16
Demonstration
  • Working with ListViews through Code
Write a Comment
User Comments (0)
About PowerShow.com