|
-
Apr 6th, 2004, 04:57 AM
#1
Listview won't show text [resolved]
This code won't actually show up any text in the listview even though its View property is set to Details.
Code:
Dim lvi As ListViewItem
With lvProcesses
.Clear()
For i As Integer = 0 To Procs.GetUpperBound(0)
lvi = New ListViewItem(Procs(i).id)
lvi.SubItems.Add(Procs(i).Name)
lvi.SubItems.Add(Procs(i).Priority)
lvi.SubItems.Add(Procs(i).Boost)
.Items.Add(lvi)
Next i
End With
What gives?
Last edited by wossname; Apr 7th, 2004 at 02:37 AM.
I don't live here any more.
-
Apr 6th, 2004, 05:00 AM
#2
Hi.
Did you remember to add the columns first?
You can add as many subitems you want, but without the columns to display them, nothing happens.
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Apr 6th, 2004, 05:41 AM
#3
Yeah, I did it from the properties pane in the IDE.
?!?
I don't live here any more.
-
Apr 6th, 2004, 07:28 AM
#4
Frenzied Member
shoulddn't you declare a new listview item INSIDE the loop? that way, a new item is declared. otherwise, the loop overwrites the same one over and over.
I thought the .clear method was the problem but that's out of the loop. (much like I am at work)lol
-
Apr 6th, 2004, 07:52 AM
#5
Well, no because when the sub goes out of scope the listview will still contain all the data. Each new listviewitem is assigned, added to the control and then overwritten.
I have just tried adding an item from the properties pane but that doesnt work either!
Bug???
I don't live here any more.
-
Apr 6th, 2004, 09:56 AM
#6
Frenzied Member
I wouldn't say it's a but because I've not read of one like that (not saying it's NOT but it would be the first I'VE heard of it.)
hmm.is it possible to zip your project and post it? I'd like to see if it works or not on MY computer.
-
Apr 6th, 2004, 11:48 AM
#7
Addicted Member
I've got your fix!
Try this:
Code:
Dim lvi As ListViewItem
With lvProcesses
.Items.Clear()
For i As Integer = 0 To Procs.GetUpperBound(0)
lvi = New ListViewItem(Procs(i).id)
lvi.SubItems.Add(Procs(i).Name)
lvi.SubItems.Add(Procs(i).Priority)
lvi.SubItems.Add(Procs(i).Boost)
.Items.Add(lvi)
Next i
End With
Just change ".Clear()" to ".Items.Clear()"
I think ".Clear()" was clearing your columns too, therefore messing up your subitems.
Worked for me!
-
Apr 6th, 2004, 12:27 PM
#8
Frenzied Member
-
Apr 7th, 2004, 02:33 AM
#9
I don't live here any more.
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
|