
Originally Posted by
Reapism
It doesn't seem to run more than once. I have call the method on load.
I know this thread is old and maby outdated, but someone could find this usefull.
Code:
Private Sub ShowTooltip(ByVal ControleName As Control, ByVal InputText As String, Optional TextLength As Integer = 40, Optional Titel As String = "Information", Optional DisplayTime As Integer = 5000)
'Add Private TT1 as New ToolTip in top of Class (Under the classname), to make it work as a form all over tooltip
Dim ActiveText As String = InputText
Dim Output As String = String.Empty
Dim PartOfstring As String = String.Empty
While ActiveText.Length > 1
If ActiveText.Length < TextLength Then
Output &= ActiveText
ActiveText = String.Empty
Else
Dim SpaceBar As Integer = 0
SpaceBar = InStr(Mid(ActiveText, TextLength, ActiveText.Length), " ")
PartOfstring = Mid(ActiveText, 1, TextLength + (SpaceBar - 1)) & Environment.NewLine
Output &= PartOfstring
ActiveText = Mid(ActiveText, TextLength + SpaceBar, ActiveText.Length)
End If
End While
TT1.ToolTipTitle = Titel
TT1.AutoPopDelay = DisplayTime
TT1.Show(Output, ControleName)
End Sub
You will use it as this example:
Code:
Private Sub Lbl_Besked_MouseHover(sender As Object, e As EventArgs) Handles Lbl_Besked.MouseHover
ShowTooltip(Lbl_Besked, Lbl_Besked.Text,, "Test Info")
End Sub
I know you have to write it in all form elements you wanna show tooltip on, but it is working as it should. Use it as an idea or leave it.