Free Visual Basic 2010 Source Code VB2010
How to Fill a ListView








HOW TO FILL A LIST VIEW USING VISUAL BASIC 2010 (VB 2010)


DESCRIPTION

This Visual Basic 2010 VB2010 code is a simple source code example of filling a ListView using Visual Basic 2010.


THE VISUAL BASIC 2010 VB2010 SETUP

Module1:
Public MyListText(10) As String
Public MyListItem As ListViewItem


Add a ListView to your form (It will automatically be called ListView1).

THE FREE VISUAL BASIC 2010 VB 2010 SOURCE CODE

Copy and Paste this code wherever you need it:

'.....Free Source Code from www.freevb2010code.com
ListView1.Clear() '.....Clear the existing data from the listview
ListView1.View = View.Details '.....IMPORTANT - Set the view to Details to allow tabulation (column mode)
'.....Add ListView Column sizes and Titles
ListView1.Columns.Add("Title1", 200, HorizontalAlignment.Left)
ListView1.Columns.Add("Title2", 200, HorizontalAlignment.Left)
ListView1.Columns.Add("Title3", 200, HorizontalAlignment.Left)
MyListText(0) = "Text1"
MyListText(1) = "Text2"
MyListText(2) = "Text3"
MyListItem = New ListViewItem(MyListText)

'.....Display the record in the ListViewBox
ListView1.Items.Add(MyListItem)
'.....Repeat the above or read an array from a loop or read a database table, the method is the same.





Home to freevb2010code.com
VB2010 How to write to a CSV file
VB2010 How to write to a TEXT file
VB2010 How to read from a CSV file
VB2010 How to read from a TEXT file
VB2010 How to find a User Name
VB2010 How to fill a ListView
VB2010 How to write a ListView data table to a CSV file
VB2010 How to call another program
VB2010 How to copy and paste to the Windows Clipboard
VB2010 How to sort an array
VB2010 How to concatenate / join strings / text


Copyright SGDesigns (c)2010

Our aim is to provide simple concise and easy to follow Free Visual Basic 2010 Source Code for the casual programmer in VB2010. We hope you find the Visual Basic 2010 code example uselful. This VB 2010 code shows a simple method on how to write to a ListView using Visual Basic 2010.





counter