Does anyone know how to show text that is wider than the listbox, I found some code, it uses a tooltip to show text if its wider but its not working, help please
using VB 2010
Private Sub ListBox2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox2.MouseMove
Dim ListMousePosition As Point = Me.ListBox2.PointToClient(Me.MousePosition)
Dim itemIndex As Integer = Me.ListBox2.IndexFromPoint(ListMousePosition)
If itemIndex > -1 Then
Dim s As String = Me.ListBox2.Items(itemIndex).ToString()
Dim g As Graphics = Me.ListBox2.CreateGraphics()
If g.MeasureString(s, Me.ListBox2.Font).Width > Me.ListBox2.ClientRectangle.Width Then
Me.ToolTip1.SetToolTip(Me.ListBox2, s)
Else
Me.ToolTip1.SetToolTip(Me.ListBox2, "")
End If
g.Dispose()
End If
End Sub