0
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

Post a Comment

 
Top