Leaders dynamic_sysop Posted October 4, 2002 Leaders Posted October 4, 2002 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... Quote
*Gurus* divil Posted October 4, 2002 *Gurus* Posted October 4, 2002 1. You're probably going to have to sort it manually. 2. The ListViewSubItem object has a ForeColor property. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Leaders dynamic_sysop Posted October 4, 2002 Author Leaders Posted October 4, 2002 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? Quote
Leaders dynamic_sysop Posted October 4, 2002 Author Leaders Posted October 4, 2002 i seem to think "if it aint broke, dont fix it" so why do microsoft alter the way code works in vb.net from how it works in vb6? Quote
*Gurus* Derek Stone Posted October 5, 2002 *Gurus* Posted October 5, 2002 Because VB6 is horrible when it comes to proper coding, to put it rather bluntly. VB.NET is an utter godsend. Quote Posting Guidelines
Leaders dynamic_sysop Posted October 5, 2002 Author Leaders Posted October 5, 2002 i must admit i do like the things i see in .net, guess it's like learning all over again tho Quote
Leaders dynamic_sysop Posted October 8, 2002 Author Leaders Posted October 8, 2002 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 :( Quote
Leaders dynamic_sysop Posted October 9, 2002 Author Leaders Posted October 9, 2002 For Each lv In ListView1.Items If lv.Text Like "*" & fileP & "*" Then lv.ImageIndex = 0 End If Next that puts the icon in place :) no need to remove it first Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.