Professional Documents
Culture Documents
List View
List View
Introduction
A list box is used to display a list of strings and all items of that control are primarily strings.
To go a little further than a simple list of strings, the Microsoft Windows operating system
provides the list view control. A list view is used to display a list of items to the user but it can
be configured to change the type of display.
To programmatically create a list view, you can declare a variable of type ListView, use
thenew operator to instantiate it and add it to its host's list of controls through a call to
theControls.Add() method. Here is an example:
Imports System.Drawing
Imports System.Windows.Forms
Module Exercise
Public Class Starter
Inherits Form
Private lvwCountries As ListView
Dim components As System.ComponentModel.Container
Public Sub New()
InitializeComponent()
End Sub
Public Sub InitializeComponent()
Text = "Countries Statistics"
Size = New Size(452, 218)
lvwCountries = New ListView()
lvwCountries.Location = New Point(12, 12)
lvwCountries.Width = 420
lvwCountries.Height = 160
Controls.Add(lvwCountries)
End Sub
End Class
Function Main() As Integer
Dim frmStart As Starter = New Starter
Application.Run(frmStart)
Return 0
End Function
End Module
Previous
http://www.yevol.com/en/vb/applicationdesign/Lesson30.htm
Next