1 / 16

Treeview and Listview Controls

Treeview and Listview Controls. Tonga Institute of Higher Education. 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.

Download Presentation

Treeview and Listview Controls

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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. 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 won’t work if ShowLines and ShowPlusMinus are true HideSelection Removes the highlight from the selected node when control doesn’t have focus Location Determines the current location of the form on the screen Name Determines the name used to reference this form in your code Nodes Determines the nodes in the treeview Scrollable Determines whether scroll bars should automatically appear if the form’s 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 Anchors the control to an edge of a container so a side of the control grows gracefully Dock Docks the control in a location in a container so the control grows gracefully Treeview Properties

  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 Property allows selected node to be changed The location of the node

  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

More Related