VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This code preforms centralized validation for input controls contained in a control array. It uses

by RL Smith (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 22nd May 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This code preforms centralized validation for input controls contained in a control array. It uses textboxes, however it can be easily

Rate This code preforms centralized validation for input controls contained in a control array. It uses



Select Case ctrlIndex
   Case Is = 0
   'if control array index(0) is empty prompt user to enter something
    If valStr = "" Then
     MsgBox "You must enter something", vbInformation
    End If
   Case Is = 1
      If Not IsNumeric(valStr) Then
       MsgBox "Numbers Only! Please enter a number"
      Else         
    End If
   End Select
End Sub


Private Sub txtBox_Validate(Index As Integer, Cancel As Boolean)
'Now call it from the control arrays validate event
Dim thisVal
 Select Case Index
  Case Is = 0
    thisVal = txtBox(0).Text
    validateInputs 0, thisVal
  Case Is = 1
    thisVal = txtBox(1).Text
    validateInputs 1, thisVal
 End Select
End Sub


Download this snippet    Add to My Saved Code

This code preforms centralized validation for input controls contained in a control array. It uses Comments

No comments have been posted about This code preforms centralized validation for input controls contained in a control array. It uses . Why not be the first to post a comment about This code preforms centralized validation for input controls contained in a control array. It uses .

Post your comment

Subject:
Message:
0/1000 characters