Populate Data into ListView Control in VB.Net

The following example Populates Data into ListView Control in VB.Net when the form is loaded.

Add a ListView Control on your Visual Basic Project and add the following code snippet on Form Load event.
Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        With ListView1

            .View = View.Details
            .FullRowSelect = True

            'Setup column headers
            .Columns.Add("Product", 100)
            .Columns.Add("Type", 100)
            .Columns.Add("Price", 50)

            For i As Integer = 0 To 10

                Dim lvi = .Items.Add("Product " & i)
                lvi.SubItems.Add("Type " & i)
                lvi.SubItems.Add("Price " & i)

            Next

        End With
End Sub
End Class

Comments

Popular posts from this blog

How to Create a Configuration.INI Files in VB6

How to Make Windows Form Transparent using Visual Basic 6/VB6

How to Set Windows Form Always on Top of Other Applications in VB6