I am using win form's list box control.
I want to add tool tips on list items. I could not find any default such properties.
Please share me , how can i add tool tips on winform list box items ?
Thank You
I am using win form's list box control.
I want to add tool tips on list items. I could not find any default such properties.
Please share me , how can i add tool tips on winform list box items ?
Thank You
If you want to do it in a listbox you will need to do it manually. Add a tooltip to the form and update the tooltip based on the mouses postion. An easier way to do this might be to use a DataGridView control like this:
DataGridView1.RowHeadersVisible = False
DataGridView1.ColumnHeadersVisible = False
DataGridView1.Columns(0).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader
Dim mydata As String() = {"Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6"}
For Each dataitem As String In mydata
DataGridView1.Rows.Add(dataitem)
Next
For Each row As DataGridViewRow In DataGridView1.Rows
row.Cells(0).ToolTipText = "ToolTip for " & row.Cells(0).Value
Next row
I thought I'd mention that there is a ShowItemToolTips
boolean attribute on ListView
, if you want to use that instead of a ListBox
. Set that attribute to true
and then assign the ToolTipText
values on the ListView
items.
Sadly, there is no implemented way to show ToolTips on each individual ListBox Item.
You can create your own ListBox control that allows you to do that, like this one: http://www.codeproject.com/Articles/457444/Listbox-Control-with-Tooltip-for-Each-Item
I able to resolve thorough below ways:
'tooltip
Dim toolTip As ToolTip = New ToolTip()
Private Sub lstReports_MouseMove(sender As Object, e As MouseEventArgs) Handles lstReports.MouseMove
Dim index As Integer = lstReports.IndexFromPoint(e.Location)
If (index <> -1 AndAlso index < lstReports.Items.Count) Then
If (toolTip.GetToolTip(lstReports) <> lstReports.Items(index).ToString()) Then
toolTip.SetToolTip(lstReports, lstReports.Items(index).ToString())
End If
End If
End Sub
one ref link:
http://dotnetfollower.com/wordpress/2012/01/winforms-show-individual-tooltip-for-each-listbox-item/ Thanks