Advertisement
ClarusDignus

Removing >0

Oct 25th, 2014
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'How to check if text box max length has been exceeded?
  2. 'http://stackoverflow.com/questions/26534314/how-to-check-if-text-box-max-length-has-been-exceeded
  3.  
  4. 'Removing >0
  5.    
  6.     Public Class Form1
  7.         Private Sub Textbox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
  8.             If Not IsNumeric(TextBox1.Text) Then
  9.                 If TextBox1.Text.Length > 8 Then
  10.                     TextBox1.Text = TextBox1.Text.Substring(0, 8)
  11.                     TextBox1.Select(TextBox1.TextLength, 0)
  12.                     ToolTip1.IsBalloon = True
  13.                     ToolTip1.ToolTipTitle = "8 character maximum and input must be numeric!"
  14.                     ToolTip1.Active = True
  15.                     ToolTip1.ToolTipIcon = ToolTipIcon.Warning
  16.                     ToolTip1.Show(vbNewLine, TextBox1, 45, -40, 2000)
  17.                     End If
  18.                 End If
  19.             Else
  20.                 If TextBox1.Text.Length > 8 Then
  21.                     TextBox1.Text = TextBox1.Text.Substring(0, 8)
  22.                     TextBox1.Select(TextBox1.TextLength, 0)
  23.                     ToolTip1.IsBalloon = True
  24.                     ToolTip1.ToolTipTitle = "8 character maximum!"
  25.                     ToolTip1.Active = True
  26.                     ToolTip1.ToolTipIcon = ToolTipIcon.Warning
  27.                     ToolTip1.Show(vbNewLine, TextBox1, 45, -40, 2000)
  28.                 Else
  29.                     ToolTip1.Active = False
  30.                     ToolTip1.Hide(TextBox1)
  31.                 End If
  32.             End If
  33.         End Sub
  34.     End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement