I have a ListView with certain id values. Am using the movemove method to display additional details about this id in a tooltip.
The code was written in VB2003 and it worked perfectly till now. Recently we migrated to VB2008.
Now the tool tip flickers. Details below.
Hope this is an easy one for the .NET big boys. I am a Java EE developer, so I’ve got very little (no) clue about what I’ve done wrong.
Compiler setting:
Target framework .NET 2.0
Code:
Dim m_HoveredItem As ListViewItem
Private Sub cancellationList_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles CancellationList.MouseMove
Dim lvi As ListViewItem = Me.CancellationList.GetItemAt(e.X, e.Y)
If Not lvi Is m_HoveredItem Then
m_HoveredItem = lvi
If lvi Is Nothing Then
Me.cancelrejectToolTip.SetToolTip(Me.CancellationList, "")
Else
Dim orderText As String() = lvi.Text.Split("(")
Dim orderRef As Integer = CInt(orderText(0).Trim)
Dim orderIsin As String
Dim orderDesc As String
Dim order As AppOrder= New AppOrder(_server, orderRef)
orderIsin = order.Isin
orderDesc = order.OrderDescription
cancelrejectToolTip.SetToolTip(Me.CancellationList, (orderRef.ToString & "/" & orderIsin & "/" & orderDesc))
End If
End If
End Sub
It looks like the mouse movement keeps moving over the visible tooltip, making it hide, but then the mouse move makes it visible again, and the cycle continues. Easiest way is to just offset the location of the tooltip using the Show method: