Can ne1 show me how to *correctly* use tooltiptexts for selecteditems in a listview, like what stealthbot, binarychat, and many other bots have.
I was trying to use the line of code: (lvChannel is my listview)
lvChannel.SelectedItem.ToolTipText = 'coding here
This didn't work, so i switched it around a few times, and it stil failed. so, can ne1 help me?
lvChannel.SelectedItem.ToolTipText = "Hi there dood"
Ok, sorry for confusing you, but i know how 2 do that, but i want it to giv each item a different tooltiptext, this way it can show each users separate stats, when i refer to stats, i mean ping and username, product and flags, mayb more.
lvChannel.Item(lvChannel.FindItem(Username).Index).ToolTipText = "Hello!"
Quote from: BaDDBLooD on September 19, 2004, 05:59 PM
lvChannel.Item(lvChannel.FindItem(Username).Index).ToolTipText = "Hello!"
Note, that isn't a very good way to find a string in the listview. I'd suggest looping through the contents, and checking for the name. If you try to do lvChannel.FindItem("UserLoser").Index, and "UserLoser" doesn't exist, a runtime error will occur
Id also Assume that your could just call you Username , Ping, and Statstring stuff .
Edit:Spelling
Quote from: UserLoser. on September 20, 2004, 01:56 PM
Quote from: BaDDBLooD on September 19, 2004, 05:59 PM
lvChannel.Item(lvChannel.FindItem(Username).Index).ToolTipText = "Hello!"
Note, that isn't a very good way to find a string in the listview. I'd suggest looping through the contents, and checking for the name. If you try to do lvChannel.FindItem("UserLoser").Index, and "UserLoser" doesn't exist, a runtime error will occur
But we use On Error Resume Next to cover it up, right? ;)
If you're going to use FindItem, use it like this:
Dim Found as ListItem
Set Found = lvChannel.FindItem("Username")
If Not (Found Is Nothing) Then
'do things with Found, ie Found.ToolTipText = "Hi!"
Set Found = Nothing
End If
That way, you destroy the reference to the found item when you're done, and you handle the chance that no item is found -- Found will be Nothing if it wasn't found.
Why not good old On Error Resume Next before the finditem code?
Quote from: -MichaeL- on September 29, 2004, 08:15 PM
Why not good old On Error Resume Next before the finditem code?
Why not actually handle the error as I did with a couple extra lines of code, rather than ignoring it? On Error Resume Next can cause problems down the road as your code progresses, it's best to avoid it whenever possible.
Hey, thanks for the info i never new that :(