Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
This simple code allows you to validate inputs for...
Author:
RL Smith
E-mail:
Click to e-mail author
Website:
http://www.itbcorp.com
Submitted:
5/23/2002
Version:
VB5
Compatibility:
VB5, VB6
Category:
Controls
Views:
11107
This simple code allows you to validate inputs for a control array for demonstration purposes. I used a standard textbox control; however, it can be easily modified to work with almost any other type of input control.
Declarations:
Option Explicit
Code:
Sub validateInputs(ctrlIndex As Integer, valStr As Variant) 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 SometextBox_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
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement