I'm using a balloon tip on a text box to indicate non-numeric entry (real-time). Once a second non-numeric character is inputted, the balloon tip position and stem orientation changes (inverts and undesirably
Code:
Public Class Form1
Private Sub Textbox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If (Not IsNumeric(TextBox1.Text) And TextBox1.Text.Length > 0) Then
ToolTip1.ToolTipTitle = "Input must be numeric!"
ToolTip1.Active = True
ToolTip1.IsBalloon = True
ToolTip1.Show(vbNewLine, TextBox1, 45, -40)
Else
ToolTip1.Active = False
ToolTip1.Hide(TextBox1)
End If
End Sub
End Class
You can check if tooltip
is visible before showing it:
Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox1.TextChanged
If (Not IsNumeric(TextBox1.Text) And TextBox1.Text.Length > 0) Then
If ToolTip1.GetToolTip(TextBox1) = "" Then
ToolTip1.ToolTipTitle = "Input must be numeric!"
ToolTip1.Active = True
ToolTip1.IsBalloon = True
ToolTip1.Show(vbNewLine, TextBox1, 45, -40)
End If
Else
ToolTip1.Active = False
ToolTip1.Hide(TextBox1)
End If
End Sub