VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

It Validates the Data Entry in a Text Box.

BharatMonga  (1 Submission)   Custom Controls/Forms/Menus   Visual Basic 5.0   Unknown Difficulty   Thu 29th May 2003   Mon 8th February 2021

It Validates the Data Entry in a Text Box.

API Declarations


then in the tag property of Text box whatever
u have write the Data Type "Chr" or "Num"
Set the form's keypreview property=true.


Public Function DataEntryValidation(Key As Integer, Param As String) As Integer

'If BckSpace then allow

If Key = 8 Then DataEntryValidation = Key: Exit Function

'Enforce only Digits

Select Case Param

Case "Num"

If Key < Asc("0") Or Key > Asc("9") Then
DataEntryValidation = 0
Else
DataEntryValidation = Key
End If

Case "Amt"

If Key < Asc("0") Or Key > Asc("9") Then
If Key <> Asc(".") Then
DataEntryValidation = 0
Else
DataEntryValidation = Key
End If

Else
DataEntryValidation = Key
End If

Case "Chr"

Key = Asc(UCase(Chr(Key)))
If Key = 8 Or Key = 32 Then DataEntryValidation = Key: Exit Function

If Key < Asc("A") Or Key > Asc("Z") Then
DataEntryValidation = 0
Else
DataEntryValidation = Asc(UCase(Chr(Key)))
End If
Case "Cbo"
DataEntryValidation = 0
Case Else
DataEntryValidation = Asc(UCase(Chr(Key)))
End Select

End Function

Rate It Validates the Data Entry in a Text Box. (1(1 Vote))
It Validates the Data Entry in a Text Box..bas

It Validates the Data Entry in a Text Box. Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters