Monday, March 28, 2011

How to add items in ListView

This is the sample program on how to add items in ListView component in visual basic. Below is the basic code of the program above. Hope this will help you. Happy coding! :)



Private Sub Form_Load()
Dim li As ListItem
With ListView1
    .View = lvwReport
    .ColumnHeaders.Add = "Column #1"
    .ColumnHeaders.Add = "Column #2"
    .ColumnHeaders.Add = "Column #3"
    Set li = .ListItems.Add(, , "Yves")
    li.SubItems(1) = "Jeoffrey"
    li.SubItems(2) = "Jauculan"
End With
End Sub

No comments:

Post a Comment