Tuesday, November 25, 2014

Show ToolTip Next to TextBox to Show Characters Left

Hi Ryan,


You need to set the tooltip into a designated controls like textbox,



Me._toolTip.SetToolTip(Me.Textbox1, String.Format("{0} characters left", Me.MaxLength - Me.Text.Length))

I made it in an easiest way to show the tooltip in a textbox, hope this would be helpful,




'Don't Forget to apply to Textbox.GotFocus
'You Can Apply it in every Controls

Dim _tooltip as New ToolTip
Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox1.TextChanged, TextBox1.GotFocus
With _tooltip
.AutomaticDelay = 100
.AutoPopDelay = 500
.InitialDelay = 50
.ReshowDelay = 20

If TextBox1.Focused = True Then
'You Need To SetToolTip([Controls],[Caption]) make it the same results from show
.SetToolTip(Me.TextBox1, TextBox1.MaxLength - TextBox1.TextLength & "Characters left")
.Show(TextBox1.MaxLength - TextBox1.TextLength & "Characters left", Me.TextBox1)
.ShowAlways = True
Else
.Hide(Me.TextBox1)
End If
End With
End Sub










No comments:

Post a Comment