-
Feb 19th, 2018, 11:38 PM
#1
Thread Starter
Frenzied Member
Listview Contol, populating first column
Code:
Dim i As Integer, theListView As ListItem
LV2.ColumnHeaders.Clear
LV2.ColumnHeaders.Add , , "Hdr1", 1000
LV2.ColumnHeaders.Add , , "Hdr2", 1000
LV2.ColumnHeaders.Add , , "Hdr3", 1000
LV2.ColumnHeaders.Add , , "Hdr4", 1000
LV2.View = lvwReport
LV2.Gridlines = True
For i = 1 To 10
Set theListView = Form3.LV2.ListItems.Add
theListView.SubItems(1) = "Row1"
theListView.SubItems(2) = "Row2"
theListView.SubItems(3) = "Row3"
' theListView.SubItems(4) = "Row4"
Next
Although I get 4 headers I cannot populate 4 columns. Both .SubItems(0) and (4) give errors if attempted.
How can I put text in column 1 ?
Last edited by AlexanderBB; Feb 19th, 2018 at 11:57 PM.
-
Feb 19th, 2018, 11:42 PM
#2
Re: Listview Contol, populating first column
The SubItems are sidecars dangling off the actual item. The "first column" is the actual item, so you assign it Text there (on the Add method call).
Crack the Fine Manual open. It is chock full of answers to such simple questions. Reading is FUNdamental to programming.
-
Feb 19th, 2018, 11:57 PM
#3
Thread Starter
Frenzied Member
Re: Listview Contol, populating first column
Last edited by AlexanderBB; Feb 20th, 2018 at 02:50 AM.
-
Feb 20th, 2018, 10:54 AM
#4
Re: Listview Contol, populating first column
I often make that first column very skinny and ignore it for that very reason.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Feb 20th, 2018, 03:45 PM
#5
Re: Listview Contol, populating first column
-
Feb 20th, 2018, 04:24 PM
#6
Re: Listview Contol, populating first column
Hey, I suppose I just really like the KISS principle ... you know that most elegant and parsimonious of solutions, like that E-mc2 thing. It seems the rare case that a report formatted ListView would have only one column. Therefore, I've always been a bit confused that they did it the way they did it anyway. So, I give it a KISS and skip the first column.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
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
|