• Welcome to Valhalla Legends Archive.
 

SelectedItem ToolTipText

Started by Yegg, September 19, 2004, 04:59 PM

Previous topic - Next topic

Yegg

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?

CrAz3D


lvChannel.SelectedItem.ToolTipText = "Hi there dood"
rebundance - having or being in excess of sheer stupidity
(ré-bun-dance)
Quote from: Spht on June 22, 2004, 07:32 PMSlap.
Quote from: Adron on January 28, 2005, 09:17 AMIn a way, I believe that religion is inherently evil, which includes Christianity. I'd also say Christianity is eviller than Buddhism (has more potential for evil).
Quote from: iago on April 19, 2005, 01:06 PM
CrAz3D's ... is too big vertically, at least, too big with ... iago ...

Yegg

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.

BaDDBLooD


lvChannel.Item(lvChannel.FindItem(Username).Index).ToolTipText = "Hello!"
There are only two kinds of people who are really fascinating: people who know absolutely everything, and people who know absolutely nothing.

UserLoser.

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

Warrior

#5
Id also Assume that your could just call you Username , Ping, and Statstring stuff .

Edit:Spelling
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

Stealth

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.
- Stealth
Author of StealthBot

Michael

Why not good old On Error Resume Next before the finditem code?

Stealth

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.
- Stealth
Author of StealthBot

Michael

Hey, thanks for the info i never new that :(