Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting different ToolTipText for each item in Listbox

Status
Not open for further replies.

daughtery

Programmer
Dec 12, 2006
66
US
How can I set a unique ToolTipText for each item in a listbox. I currently have the follwoing code but it sets the toolTipText for all to the last value to run in the loop:

Code:
 Do While Not frmCatalogRequirements.prsFilingFrqSelected.EOF
        lstAvailableFF.AddItem frmCatalogRequirements.prsFilingFrqSelected("Description") & " (" & frmCatalogRequirements.prsFilingFrqSelected("Code") & ")"
        lstAvailableFF.ToolTipText = frmCatalogRequirements.prsFilingFrqSelected("Description") & " (" & frmCatalogRequirements.prsFilingFrqSelected("Code") & ")"
        frmCatalogRequirements.prsFilingFrqSelected.MoveNext
    Loop
 
I'm not sure myself how to set a ToolTip for each item (in a ListBox anyway), but I can tell you why you're only seeing the last records details as a tip.

The value being set is not the ToolTip for the List's Item, rather the ToolTip for the control (the ListBox) during the loop (each iteration of the loop overwrites the previous value displaying the last one after the loop ends).

As I say, I'm not sure how to set each items individual ToolTip in a Listbox, it's been a while since I've needed to do anything like this but I'm pretty sure you can do it in a ListView if that's any help?

Hope this helps

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top