Guest User

Untitled

a guest
Dec 10th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. Imports System.Drawing
  2. Imports System.Text.RegularExpressions
  3. Imports System.Windows.Forms
  4.  
  5. Module Module1
  6. Public Enum ValidationType
  7. MaxMin = 1
  8. End Enum
  9. Public Sub AssignValidation(ByRef CTRL As TextBox, ByVal Validation_Type As ValidationType, Min As Double, Max As Double)
  10. Dim txt As TextBox = CTRL
  11.  
  12. Select Case Validation_Type
  13. Case ValidationType.MaxMin
  14. AddHandler txt.TextChanged, AddressOf MaximumMinimum
  15. End Select
  16.  
  17. End Sub
  18.  
  19. Public Sub MaximumMinimum(ByVal sender As Object, ByVal e As System.EventArgs)
  20. Dim NO As TextBox = sender
  21. If Val(NO.Text) < Min Then
  22. NO.Focus()
  23. ElseIf Val(NO.Text) > Max Then
  24. NO.Focus()
  25. End If
  26. End Sub
  27.  
  28. End Module
Add Comment
Please, Sign In to add comment