This code preforms centralized validation for input controls contained in a control array. It uses
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
(1(1 Vote))
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
This code preforms centralized validation for input controls contained in a control array. It uses Comments
No comments yet — be the first to post one!
Post a Comment