This example adds several ListItem objects with subitems to a ListView control. When you click on the CommandButton, the HideColumnHeaders property toggles between True (-1) and False (0). To try the example, place ListView and CommandButton controls on a form and paste the code into the form's Declarations section. Run the example and click the CommandButton to toggle the HideColumnHeaders property.
Private Sub Command1_Click()
' Toggle HideColumnHeaders property off and on.
ListView1.HideColumnHeaders = Abs(ListView1.HideColumnHeaders) - 1
End Sub
Private Sub Form_Load()
Dim clmX As ColumnHeader
Dim itmX As ListItem
Dim i As Integer
Command1.Caption = "HideColumnHeaders"
' Add 3 ColumnHeader objects to the control.
For i = 1 To 3
Set clmX = ListView1.ColumnHeaders.Add()
clmX.Text = "Col" & i
Next I
' Set View to Report.
ListView1.View = lvwReport
' Add 10 ListItems to the control.
For i = 1 To 10
Set itmX = ListView1.ListItems.Add()
itmX.Text = "ListItem " & i
itmX.SubItems(1) = "Subitem 1"
itmX.SubItems(2) = "Subitem 2"
Next i
End Sub