|
-
Oct 28th, 2009, 05:28 AM
#1
Thread Starter
New Member
Unable to add columns
Hi all,
I am trying to use the list view control. Everything works fine except adding columns.
I found this code on net and trying adding columns. However, it adds only 1 column. I just could not understand the reason for it. Please help.
Private Sub Form_Load()
Dim column_header As ColumnHeader
Dim list_item As ListItem
' Create the column headers.
Set column_header = ListView1. _
ColumnHeaders.Add(, , "Abbrev", _
TextWidth("Abbrev"))
Set column_header = ListView1. _
ColumnHeaders.Add(, , "Title", _
TextWidth("Ready-to-Run Visual Basic Algorithms"))
Set column_header = ListView1. _
ColumnHeaders.Add(, , "ISBN", _
TextWidth("0-000-00000-0"))
' Start with report view.
mnuViewChoice_Click lvwReport
' Associate the ImageLists with the
' ListView's Icons and SmallIcons properties.
ListView1.Icons = imgLarge
ListView1.SmallIcons = imgSmall
Set list_item = ListView1.ListItems.Add(, , "VBA")
list_item.Icon = 1
list_item.SmallIcon = 1
list_item.SubItems(1) = "Ready-to-Run Visual Basic " & _
"Algorithms"
list_item.SubItems(2) = "0-471-24268-3"
Set list_item = ListView1.ListItems.Add(, , "VBGP")
list_item.Icon = 1
list_item.SmallIcon = 1
list_item.SubItems(1) = "Visual Basic Graphics " & _
"Programming"
list_item.SubItems(2) = "0-471-15533-0"
Set list_item = ListView1.ListItems.Add(, , "CCL")
list_item.Icon = 1
list_item.SmallIcon = 1
list_item.SubItems(1) = "Custom Controls Library"
list_item.SubItems(2) = "0-471-24267-5"
Set list_item = ListView1.ListItems.Add(, , "AVBT")
list_item.Icon = 1
list_item.SmallIcon = 1
list_item.SubItems(1) = "Advanced Visual Basic " & _
"Techniques"
list_item.SubItems(2) = "0-471-18881-6"
End Sub
Thanks,
Sushant
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|