Valhalla Legends Forums Archive | Visual Basic Programming | SelectedItem.ForeColor?

AuthorMessageTime
Yegg
ok, im trying to get my bot to have different forecolors for the channel list. for instance, if the user's flags are 2 or 18, it's forcolor would be White, normal flags would be yellow, and your own username would be Cyan.
heres the code i have and it isn't working at all. all it is doing is changing the color of the user at the top of the channel.

(all this code is under OnUser)

[code]If flags = 2 Or flags = 18 Then
lvChannel.SelectedItem.ForeColor = vbWhite
lvPing.SelectedItem.ForeColor = vbWhite
ElseIf username = BNET.TrueUsername Then
lvChannel.SelectedItem.ForeColor = vbCyan
lvPing.SelectedItem.ForeColor = vbCyan
ElseIf Not flags = 2 Or Not flags = 18 Then
lvChannel.SelectedItem.ForeColor = vbYellow
lvPing.SelectedItem.ForeColor = vbYellow
End If
lvChannel.ListItems.add , , username
lvPing.ListItems.add , , Ping & "ms"[/code]

some1 help me with this code.
November 5, 2004, 10:35 PM
R.a.B.B.i.T
I do this in my bots also.  Use FindItem() to grab the index of the username you want to change, then use ListItems() to set its forecolor.
November 5, 2004, 10:38 PM
Yegg
hmm, im tryign 2 do this, but im not sur exactly how i set the code up. can u giv a small example?
November 5, 2004, 10:45 PM
phvckmeh
lvChannel.ListItems(lvChannel.FindItem(Username).Index).ForeColor = vbCyan
November 5, 2004, 11:42 PM
Yegg
I now have the following code and it does not work.

[code]If flags = 2 Or flags = 18 Then
lvChannel.ListItems(lvChannel.FindItem(username).index).ForeColor = vbWhite
End If[/code]
November 6, 2004, 12:34 AM
R.a.B.B.i.T
Ahh, I was going off the top of my head and was wrong:[code]Form1.lvChannel.FindItem(UserName).ForeColor = vWhite[/code]
November 6, 2004, 12:55 AM
LivedKrad
Yegg, in the event for OnUser, whatever that may be, you'll have to find your own username first.
[code]
If Username = "Yegg" Then
Form1.lvChannel.FindItem(Username).ForeColor = vbCyan
End If
[/code]

Or, so the code will be faster because 1 check will only be true...
[code]
Select Case Flags
Case 2
  Form1.lvChannel.FindItem(Username).ForeColor = vbWhite
Case 18
  Form1.lvChannel.FindItem(Username).ForeColor = vbWhite
Case Else
  Form1.lvChannel.FindItem(Username).ForeColor = vbYellow
End Select
[/code]

Now, we're assuming here that all Usernames have been assigned yellow or white, and now we can find our own.

[code]
If Username = "Yegg" Then
Form1.lvChannel.FindItem(Username).ForeColor = vbCyan
End if
[/code]
This all should work, if not, then reply back.
November 6, 2004, 5:43 PM

Search