I have added three images to ImageList..I want to show tooltip....On listview item...

Public Class Form2

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ListView1.View = View.LargeIcon
        ListView1.LargeImageList = ImageList1
        For lcount As Integer = 1 To 3
            ListView1.Items.Add(lcount.ToString, lcount - 1)
        Next

    End Sub

    Private Sub ListView1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.MouseLeave
        Dim a As New ToolTip
        a.SetToolTip(ListView1, "")
    End Sub

    Private Sub ListView1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseMove
        Dim thisItem As ListViewItem = ListView1.GetItemAt(e.X, e.Y)

        Dim a As New ToolTip

        If Not thisItem Is Nothing Then

            a.SetToolTip(ListView1, thisItem.Text)

        Else

            a.SetToolTip(ListView1, "")

        End If

    End Sub
End Class

Mine code is working fine..But probs is that..as i hover the mouse suppose over the first image tooltip is shown..Now when i hover the mouse on second image..first image tooltip is still there..I want first tooltip to be disappeared...How to do that..can somebody tell me help me??/

Enabled the ListView1.ShowItemToolTips = True.

ListView1.View = View.LargeIcon
       ListView1.ShowItemToolTips = True
       For lcount As Integer = 1 To 3
            ListView1.Items.Add(lcount.ToString, lcount - 1).ToolTipText = "Item" & lcount
        Next

Thx very much.....One thing i want to say dat ur all answers are 100% Correct...I have noted it many times..Grt Effort..Salute to U!!!!!!!

hello Sir or frnd,tell me one thing more is that possible to show image in tooltip?????//

Thanks,

Mark this thread as Solved if you get solution.

Sir i get the solution..BUt i have one other probs..I want to draw image & text in tooltip..
Currently I m able to draw only text...To drwa image..I searced on the net & found the foll. link-
http://www.vb-helper.com/howto_2005_ownerdraw_tooltip.html

Private Sub ToolTip1_Draw(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawToolTipEventArgs) Handles ToolTip1.Draw
        e.DrawBackground()
        e.DrawBorder()

        ' Draw the text.
        Using sf As New StringFormat()
            sf.Alignment = StringAlignment.Near
            sf.LineAlignment = StringAlignment.Center
            Dim rect As New Rectangle(50, 0, e.Bounds.Width - _
                50, e.Bounds.Height)
            e.Graphics.DrawString(e.ToolTipText, e.Font, _
                Brushes.Green, rect, sf)
        End Using

        ' Draw the image.
        e.Graphics.DrawImage(My.Resources.btnURLGO, 9, 9)
    End Sub

    Private Sub ToolTip1_Popup(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PopupEventArgs) Handles ToolTip1.Popup
        Dim wid As Integer = e.ToolTipSize.Width + 50
        Dim hgt As Integer = e.ToolTipSize.Height
        If hgt < 50 Then hgt = 50
        e.ToolTipSize = New Size(wid, hgt)
    End Sub

But these events are not firing..Can u help me on this matter!!!!!!!!!

Set OwnerDraw Property of tooltip control and also add two events - Draw and Popup.

hello,
i am doing the room management system project in vb.net.in that i have used the list view to display the room details.so when i reserve a room,it will goes to the corner of listview from the previous place.but it want to be stay that same place.so anyone help me to solve this problem.
thanking you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.