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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I set hover text? newbie question

Status
Not open for further replies.

diggerfm

Programmer
May 10, 2002
4
0
0
US
I should know this - or be able to find it, but I can't! Please help... I'm simply trying to set the hover text for a listbox in vb.net... I realize the MouseEnter, MouseLeave, and MouseHover events, but can't figure out how to set the actual text shown! and I'm stumped!

I appreciate any help...
 
I think what you are looking for is the ToolTipText property. Below is some code I use that gives a more cool look to the otherwise drag listbox.

'Add a listbox to a form...run the code

Option Explicit
Private m_ItemsDisplayed As Long
Private Sub Form_Load()
Dim i As Long
For i = 1 To 100
List1.AddItem i
Next i
List1.TopIndex = List1.ListCount - 1
m_ItemsDisplayed = List1.ListCount - List1.TopIndex
List1.Clear
List1.AddItem "one"
List1.AddItem "two"
List1.AddItem "Three"
List1.AddItem "four"
List1.AddItem "five"
List1.AddItem "six"
End Sub

Private Sub List1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
List1.ListIndex = CInt(Y / List1.Height * m_ItemsDisplayed)
List1.ToolTipText = List1.Text
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top