|
-
Nov 25th, 2000, 08:00 AM
#1
Thread Starter
Lively Member
Hi guys,
Need desperate advice on how to use listview boxes in report mode. Manage to create some columnheaders but i simple can't find the way to add items.
-
Nov 25th, 2000, 08:09 AM
#2
_______
<?>
Maybe you can pick this apart.
Code:
'create obj var for columnHeader obj and listitem obj
Dim sColumn As ColumnHeader
Dim sItem As ListItem
'
'start in report view
Listview1.View = lvwReport
'
'set the size and pos of the listview
'
Listview1.Width = ScaleWidth
Listview1.Height = ScaleHeight
Listview1.Top = ScaleTop
Listview1.Left = ScaleLeft
'
'set the list ctrl icon properties
'this initializes the image list
Listview1.Icons = ilsLargeIcons
Listview1.SmallIcons = ilsSmallIcons
'
'add columnHeaders..the width of the columns is
'the widht of the ctrl / 2 by the num of headers
'
Set sColumn = Listview1.ColumnHeaders.Add(, , "Name")
Set sColumn = Listview1.ColumnHeaders.Add(, , "Phone #1")
Set sColumn = Listview1.ColumnHeaders.Add(, , "Phone #2")
'
'add some data to the listitem (sItem)
Set sItem = Listview1.ListItems.Add(, , "Kim & Deb", 1, 1)
sItem.SubItems(1) = "905-799-9415"
sItem.SubItems(2) = "who knows"
'second name Remove the 1,1 to show no icons
Set sItem = Listview1.ListItems.Add(, , "Phil & Tony", 1, 2)
sItem.SubItems(1) = "416-000-0099"
sItem.SubItems(2) = "who knows"
'third item
Set sItem = Listview1.ListItems.Add(, , "Jamie & Lana")
sItem.SubItems(1) = "905-444-9455"
sItem.SubItems(2) = "who knows"
'
'
' How to Populate the list with data via code
'fill an array with information
Dim myArr(99)
Dim i As Integer
For i = 1 To 99
myArr(i) = CInt(Rnd * 99)
Next i
'then load the array
For i = 1 To 99
'used different images every second line
'image one for odd, image2 for even
If i Mod 2 <> 0 Then
Set sItem = Listview1.ListItems.Add(, , myArr(i), 1, 1)
Else
Set sItem = Listview1.ListItems.Add(, , myArr(i), 2, 2)
End If
'add subitems
sItem.SubItems(1) = "905-444-9455"
sItem.SubItems(2) = "who knows"
Next i
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 26th, 2000, 12:01 AM
#3
Thread Starter
Lively Member
Hi, tried your method but the compiler says that the image list is not initialised. Pls help.
-
Nov 26th, 2000, 04:06 AM
#4
Hyperactive Member
Remove the last two numbers from every add.
Code:
Dim sItem As ListItem
Set sItem = Listview1.ListItems.Add(, , "Kim & Deb")
sItem.SubItems(1) = "905-799-9415"
sItem.SubItems(2) = "who knows"
They're numbers to add icons from an imagelist.
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
|