Technical Training
VB.NET 2005Table of Contents
.NET Common Windows Forms Controls Part 2
.NET Common Windows Forms Controls Part 2 - Page 2
.NET Common Windows Forms Controls Part 2 - Page 3.NET Common Windows Forms Controls Part 2 Page - 2
.NET Common Windows Forms Controls Part 2
.
.
TreeView
Tree Views are used to display a hierarchy of nodes. Each node can have several child nodes. A typical example of this is the Widows Explorer. In the Windows Explorer you can see the tree view of the directory of the drives. You can either expand all the levels or collapse the nodes just by clicking on them. When they are expanded, you can see all their children. You can also choose the icon that will be displayed for the node. If the CheckBoxes property is set to true, then you can see that the tree view shows a check box. Nodes and SelectedNode are the two main properties of this control. The Node property contains the list of nodes in the tree view. SelectedNode property gets or sets the currently selected node. The nodes collection for a node holds the node’s child TreeNode objects. You can add or remove or clone a TreeNode. Tree views also support other properties for navigating through them, node by node. The properties like FirstNode, lastNode, NextNode, PreNode, NextVisibleNode, PreVisibleNode are used for this purpose.
ListView
In contrast to the TreeView the ListView is used to list the items in the right side of the windows and it serves as complimentary to the TreeView. ListViews can display their items in four different methods viz., View.largeIcon, View.SmallIcon, View.list, and View.Details.
ListItems is the property of the Listview, that contains the items displayed by the control. The SelectedItems property contains a collection of the items currently selected in the control. If the multi-select property is set to true, then the user can select multiple item.
Timer
Timer Class is a component that is used to create periodic Tick events that to execute code at specific interval. Some of the properties, methods and events are given below:
|
Property/Method/Event |
Description |
|
Enabled |
Gets/Sets whether the timer is running |
|
Interval |
Gets/Sets the time in milliseconds between timer ticks |
|
Start |
Starts the timer |
|
Stop |
Stops the timer |
|
Tick |
Occurs the timer interval has elapsed |
The timer can be started or stopped using the method Start() and Stop(). The Tick event handler will be used to add codes that we need to manipulate the activity of the timer. Each tick event takes place at a default time of 100 milliseconds. This default value can be changed. The following demo illustrates the usage of the timer component.
To a new project in Visual Basic
Express add a timer component to the Form1.
Add two buttons.
Add the following code to the page:
The output generated by the program is shown below:
The startup screen is shown below:

When you press the Timer button, it calls the TimerStartStop method defined which starts the timer and throws a message box which you see below

When you click Ok in the MessageBox, it stops the timer. While the timer is running the Tick event handler is incrementing the value of the variable t by 100 for every tick, which is the default time it takes between two successive Tick events. The timer event is stopped and the value of t is assigned to t2 after dividing it by 1000 to convert to seconds. This value is now displayed using the last MessageBox.

VB.NET 2005
- VB.NET 2005 Free Training
- The .NET Framework Architecture Part 1
- The .NET Framework Architecture Part 2
- Application Class and Message Class
- Implementing Class Library Object
- Visual Studio.NET Namespaces
- .NET Assemblies
- Differences between VB.NET 1.0 and VB.NET 2.0
- Introducing VB.NET Windows Forms
- Visual Studio Windows Forms Designer
- Exploring the Forms Designer generated code
- Setting and Adding Properties to Windows Form
- Implementing Inheritance
- Event Handling In Visual Basic .NET
- Building Graphical Interface elements
- .NET Common Windows Forms Controls Part 1
- .NET Common Windows Forms Controls Part 2
- Common Controls and Handling Control Events
- DomainUpDown and NumericUpDown Controls
- Dialog Boxes in Visual Basic .NET
- Visual Studio Adding Controls to Windows Form
- VB.NET Validation Controls
- Working with Menu Controls
- VB.NET MDI Applications
- .NET Exceptions
- VB.NET Creating and Managing Components Part 1
- VB.NET Creating and Managing Components Part 2
- Simple Data Binding
- .NET Complex Data Binding
- .NET Data Form Wizard
- Data Manipulation with ADO.NET
- SQL Server Stored Procedures
- SQL Server Ad Hoc Queries
- Finding and Sorting Data in DataSets
- ADO.NET Object Model
- Working with DataSets
- Using XML Data
- Working with File System in .NET
- Creating Web Service
- Instantiating - Invoking Web Services, Creating Proxy Classes with WSDL
- Web Reference and Web Services
- Web Services - SOAP, WSDL, Disco and UDDI
- Web Application Testing in VB.NET 2005
- Web Application Tracing and Debugging
- Working with Legacy Code and COM Components
- ActiveX Controls and Legacy Code
- Windows Application Testing
- VB.NET Windows Application Testing
- Tracing VB.NET Windows Application
- Debugging Windows Applications In Visual Studio.NET 2005
- Deploying Windows Applications In Visual Studio.NET 2005
- Customizing Setup Project in Visual Studio.NET 2005
- Shared Assembly
- Microsoft .NET Creating Installation Components
- The Registry Editor in Visual Studio.NET 2005
- The File Types Editor







