Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Drawing
- Imports System.Text.RegularExpressions
- Imports System.Windows.Forms
- Module Module1
- Public Enum ValidationType
- MaxMin = 1
- End Enum
- Public Sub AssignValidation(ByRef CTRL As TextBox, ByVal Validation_Type As ValidationType, Min As Double, Max As Double)
- Dim txt As TextBox = CTRL
- Select Case Validation_Type
- Case ValidationType.MaxMin
- AddHandler txt.TextChanged, AddressOf MaximumMinimum
- End Select
- End Sub
- Public Sub MaximumMinimum(ByVal sender As Object, ByVal e As System.EventArgs)
- Dim NO As TextBox = sender
- If Val(NO.Text) < Min Then
- NO.Focus()
- ElseIf Val(NO.Text) > Max Then
- NO.Focus()
- End If
- End Sub
- End Module
Add Comment
Please, Sign In to add comment