|
-
Feb 18th, 2000, 09:52 PM
#1
Thread Starter
Member
my question is about the list view in the microsoft windows control 5 i think it is.
i have 2 colums in my list view, but how do i write to the second column? to write to the listview this seems to work:
ListView1.ListItems.Add , , "whatever"
but if i do this:
ListView1.ListItems.Add (2) , , "whatever"
it still writes to the first column.
someone told me to do this:
listview1.ListItems.Item(2).ListSubItems.Add , , "Cya"
but that does not work for me maybe because I am in vb5, so how do you actually enter something in the second column?
thanx
------------------
Mooose
-
Feb 19th, 2000, 10:13 AM
#2
Columns after the first one are treated as SubItems. Here's an example:
Code:
Private Sub Command1_Click()
Dim xListItem As ListItem
Dim xColHeader As ColumnHeader
Dim i As Integer
With ListView1
Set xColHeader = .ColumnHeaders.Add(, , "Column1")
Set xColHeader = .ColumnHeaders.Add(, , "Column2")
Set xColHeader = .ColumnHeaders.Add(, , "Column3")
Set xListItem = .ListItems.Add(, , "First Value")
'SubItems are 1 - based
For i = 1 To .ColumnHeaders.Count - 1
xListItem.SubItems(i) = "SubItem" & i & " value"
Next
End With
End Sub
------------------
Serge
Senior Programmer Analyst
[email protected]
[email protected]
ICQ#: 51055819
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
|