473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Mouse over tooltip

I have a ListBox, which is binded to a DataTable.
I would like to display a tooltip when the mouse cursor hovers over the
items in the ListBox.
I don't know how to find the index if ListBox item, on which mouse
cursor is over and how to display the tooltip.
Any suggestions?

TIA

Nov 21 '05 #1
5 11990
In the ListBox's "MouseMove" event, you can track the mouse location and set
form level variables to it's X,Y location. Then in the MouseHover Event, you
can get the ListBox Index that the mouse is over from the IndexFromPoint
method and the X,Y form level variables. You can then assign ToolTip.Text
equal to whatever you want depending on the index that the mouse is hovering
over. Unfortunately, I haven't found a way to get the tooltip to redisplay
unless the mouse is moved out of the control then back over the control.

--
Dennis in Houston
"Nikolay Petrov" wrote:
I have a ListBox, which is binded to a DataTable.
I would like to display a tooltip when the mouse cursor hovers over the
items in the ListBox.
I don't know how to find the index if ListBox item, on which mouse
cursor is over and how to display the tooltip.
Any suggestions?

TIA

Nov 21 '05 #2
In the ListBox's "MouseMove" event, you can track the mouse location and set
form level variables to it's X,Y location. Then in the MouseHover Event, you
can get the ListBox Index that the mouse is over from the IndexFromPoint
method and the X,Y form level variables. You can then assign ToolTip.Text
equal to whatever you want depending on the index that the mouse is hovering
over. Unfortunately, I haven't found a way to get the tooltip to redisplay
unless the mouse is moved out of the control then back over the control.

--
Dennis in Houston
"Nikolay Petrov" wrote:
I have a ListBox, which is binded to a DataTable.
I would like to display a tooltip when the mouse cursor hovers over the
items in the ListBox.
I don't know how to find the index if ListBox item, on which mouse
cursor is over and how to display the tooltip.
Any suggestions?

TIA

Nov 21 '05 #3
Hi,

When I use this code the tooltip is always displayed when the mouse
is over the listbox.

Private Sub ListBox2_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles ListBox2.MouseMove
Dim i As Integer = ListBox2.IndexFromPoint(e.X, e.Y)

If i >= 0 Then ToolTip1.SetToolTip(ListBox2,
ListBox2.Items.Item(i).ToString)

End Sub

Ken
---------------------------
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:E1**********************************@microsof t.com...
In the ListBox's "MouseMove" event, you can track the mouse location and
set
form level variables to it's X,Y location. Then in the MouseHover Event,
you
can get the ListBox Index that the mouse is over from the IndexFromPoint
method and the X,Y form level variables. You can then assign ToolTip.Text
equal to whatever you want depending on the index that the mouse is
hovering
over. Unfortunately, I haven't found a way to get the tooltip to
redisplay
unless the mouse is moved out of the control then back over the control.

--
Dennis in Houston
"Nikolay Petrov" wrote:
I have a ListBox, which is binded to a DataTable.
I would like to display a tooltip when the mouse cursor hovers over the
items in the ListBox.
I don't know how to find the index if ListBox item, on which mouse
cursor is over and how to display the tooltip.
Any suggestions?

TIA

Nov 21 '05 #4
Hi,

When I use this code the tooltip is always displayed when the mouse
is over the listbox.

Private Sub ListBox2_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles ListBox2.MouseMove
Dim i As Integer = ListBox2.IndexFromPoint(e.X, e.Y)

If i >= 0 Then ToolTip1.SetToolTip(ListBox2,
ListBox2.Items.Item(i).ToString)

End Sub

Ken
---------------------------
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:E1**********************************@microsof t.com...
In the ListBox's "MouseMove" event, you can track the mouse location and
set
form level variables to it's X,Y location. Then in the MouseHover Event,
you
can get the ListBox Index that the mouse is over from the IndexFromPoint
method and the X,Y form level variables. You can then assign ToolTip.Text
equal to whatever you want depending on the index that the mouse is
hovering
over. Unfortunately, I haven't found a way to get the tooltip to
redisplay
unless the mouse is moved out of the control then back over the control.

--
Dennis in Houston
"Nikolay Petrov" wrote:
I have a ListBox, which is binded to a DataTable.
I would like to display a tooltip when the mouse cursor hovers over the
items in the ListBox.
I don't know how to find the index if ListBox item, on which mouse
cursor is over and how to display the tooltip.
Any suggestions?

TIA

Nov 21 '05 #5
Thanks Ken

Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nikolay Petrov | last post by:
I have a ListBox, which is binded to a DataTable. I would like to display a tooltip when the mouse cursor hovers over the items in the ListBox. I don't know how to find the index if ListBox item,...
5
by: Nick | last post by:
Hey guys, I have 2 events on a windows forms datagrid, the mouse move as well as the double click events. What's happening is that when I double click on a row in the grid, the mouse move event...
5
by: Pavan | last post by:
My goal is to accomplish the tooltip functionality for all the neodes in a tree view and i have the following three Events in my C# application. Name of my TreeView Control (AITreeView) 1)...
2
by: cody | last post by:
What are the yellowish popups that appear when you mouse over certain objects. An example are the descriptions that appear in VS2005 when hover your mouse over controls in the toolbox. I'd like...
3
by: Eric Layman | last post by:
Hi everyone. An image allows alt attribute. When mouse over images with alt attribute, a small yellow popup would appear besides the mouse cursor. How to replicate this behaviour using a table...
2
by: hini | last post by:
Hi all, I use IE, and I am trying to display a tooltip using javascript. the problem is that the tooltip is not apearing where I want it to be. I am getting the mouse location using clientX and...
7
exoskeleton
by: exoskeleton | last post by:
hi guys..hope you can help me...my boss want me to edit our website and apply the tooltip thing, i mean the moving tooltip that follows the mouse.. please help...thank you... :(
7
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hello, I'm using the ToolTip control, but I want it to behave a bit different. I want the toolTip to popup not only once when the control is enter and the mouse is stationary. I want the...
0
by: tezu | last post by:
Hi all, Im currently having a list view with two columns Key and Value .Key column contains Items and the VAlue contains the subitems.... I want to dispaly the value of each item n subitem in a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.