a few listview questions in 1 go...

dynamic_sysop

Senior Contributor
Joined
Oct 1, 2002
Messages
1,039
Location
Ashby, Leicestershire.
ok i now know how to remove an item from a listview in vb.net by comparing it, a few things that i'd like to know ( if these things are possible )
1, i run an msn chatroom, there are various member profile icons and i filter all the usernames on joining a chatroom with my client, however an owner = "gold hammer" icon and a host = "brown hammer" icon, now these appear at the top of the list normally in a chtroom, but the only way to get them to the top and make them stay there is to put a space before the name ( the problem is that this mixes host and owner icons together and "gold" should be at the very top followed by "brown", basically to cut it short is it possible to tell a listview that if a name has a gold or brown icon next to it that them names should be at the top of the list?

2, in vb6 using custom control pack 6 i can change the colour of a particular line in a listview, so if i join a chatroom and someone is marked as "away" my client put's a cup next to the persons name and shades the name grey. is it possible to do something like this in .net?
in vb6 i'd use something like Lview.Listitems(i).Forecolor = &000 etc...
 
1. You're probably going to have to sort it manually.

2. The ListViewSubItem object has a ForeColor property.
 
so basically if i do something like ..... Dim L as ListViewSubItem
Dim sName as String
For Each L in ListView.Items
if Lisview.Items(L) = sName Then
Lisview.Items.Forecolor = "blabla"
exit for
end if
next

would that work for the colour of the item?
 
this listview thing is going well, however a few things that are a bit long winded are...
Public Sub BeGoldAway(ByVal fileP As String)

For Each lv In ListView1.Items
If lv.Text Like fileP Then
ListView1.Items.Remove(lv)
ListView1.Items.Add(fileP & "(host)", 8)
End If
Next
End Sub

basically to add an icon next to a name in the list i have to remove the name then add it again, the reason is that to start with i just add all the names then i filter their profile values which all have different icons. there must be a way tho to just add the icon in that sub, like in vb6 it would be "listview1.Listitems(i).smallicon = 0"
also have tried various ways to change the colour of a particular icon but no joy :(
 
Back
Top