User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 427,939 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,811 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 268 | Replies: 4
Reply
Join Date: Nov 2007
Posts: 11
Reputation: sniper1983 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
sniper1983 sniper1983 is offline Offline
Newbie Poster

Hover problem..

  #1  
Jul 8th, 2008
Hi,

I have a simple question about hovering in a checklistbox. How can I get the value(object ) the hovered item..?

I have tried something like this:
Private Sub CheckboxHover(ByVal sender As Object, ByVal e As EventArgs) Handles CheckedListBox1.MouseHover
'MsgBox(sender.GetType.ToString & ", " & e.GetType.ToString)
'Dim mSender As CheckedListBox = sender
ToolTip1.SetToolTip(Me.CheckedListBox1, "s")
End Sub

The eventargs gives no possibilities and I do not know how to get the hovered Item in the sender..?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2002
Location: West Virginia
Posts: 388
Reputation: waynespangler is on a distinguished road 
Rep Power: 6
Solved Threads: 40
waynespangler waynespangler is offline Offline
Posting Whiz

Re: Hover problem..

  #2  
Jul 8th, 2008
I don't know what you are doing but it is the Enter and Leave properties.
Private Sub CheckBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.Enter
End Sub
Last edited by waynespangler : Jul 8th, 2008 at 8:14 am.
Wayne

It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
Reply With Quote  
Join Date: Feb 2008
Location: Sivakasi, Tamilnadu, India
Posts: 460
Reputation: selvaganapathy is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 79
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro in Training

Re: Hover problem..

  #3  
Jul 8th, 2008
Hi, To get the Hover Item, Use MousePosition property and CheckedListBox.IndexFromPoint Function.

Ex

  1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2. For i As Integer = 0 To 10
  3. CheckedListBox1.Items.Add(i)
  4. Next
  5. End Sub
  6. Dim iInd As Integer
  7. Private Sub CheckedListBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles CheckedListBox1.MouseMove
  8. Dim iMouse As Point
  9. Dim iNewInd As Integer
  10. iMouse = CheckedListBox1.PointToClient(Control.MousePosition)
  11. iNewInd = CheckedListBox1.IndexFromPoint(iMouse)
  12.  
  13. If (iNewInd >= 0 And iNewInd < CheckedListBox1.Items.Count) And iInd <> iNewInd Then
  14. CheckedListBox1.SelectedIndex = iNewInd
  15. ToolTip1.SetToolTip(CheckedListBox1, CheckedListBox1.Items.Item(iInd))
  16. iInd = iNewInd
  17. End If
  18.  
  19. End Sub
Last edited by selvaganapathy : Jul 8th, 2008 at 12:34 pm.
KSG
Reply With Quote  
Join Date: Nov 2007
Posts: 11
Reputation: sniper1983 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
sniper1983 sniper1983 is offline Offline
Newbie Poster

Re: Hover problem..

  #4  
Jul 9th, 2008
Wayne, thanks but it was not what I was looking for..

Selvaganapathy, that was exactly what I wanted.. Nice, thanks a lot.. I just wanted the current selected one so I replaced The iInd with iNewInd but it is exactly what I needed..
Reply With Quote  
Join Date: Feb 2008
Location: Sivakasi, Tamilnadu, India
Posts: 460
Reputation: selvaganapathy is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 79
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro in Training

Re: Hover problem..

  #5  
Jul 9th, 2008
Oh Good,

I mistakenly wrote iInd instead of iNewInd in
ToolTip1.SetToolTip(CheckedListBox1, CheckedListBox1.Items.Item(iInd))
KSG
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb VB.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 6:34 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC