- Home
·
- Miscellaneous
·
- This function validates numbers entered in the text box and restricts 2 decimal places,and this is
This function validates numbers entered in the text box and restricts 2 decimal places,and this is
This function validates numbers entered in the text box and restricts 2 decimal places,and this is called in the keypress event of the text
Rate This function validates numbers entered in the text box and restricts 2 decimal places,and this is
(1(1 Vote))
Dim Deciprs As Boolean
Dim Ctr As Integer
Dim Decipos As Integer
Decipos = InStr(Strinfo, ".")
If Decipos Then
Deciprs = True
Else
Deciprs = False
End If
Select Case Key
Case vbKey0 To vbKey9
If Deciprs = True Then
Ctr = Len(Mid(Strinfo, Decipos + 1, Len(Strinfo) - Decipos + 1))
If Ctr = 2 Then
Txtnumdeci = 0
Else
Txtnumdeci = Key
End If
Else
Txtnumdeci = Key
End If
Case vbKeyBack
Txtnumdeci = Key
Case vbKeyDecimal, Asc(".")
If Deciprs = True Then
Txtnumdeci = 0
Else
Txtnumdeci = Key
End If
Case vbKeyReturn
SendKeys "{TAB}"
Case Else
Txtnumdeci = 0
End Select
End Function
This function validates numbers entered in the text box and restricts 2 decimal places,and this is Comments
No comments yet — be the first to post one!
Post a Comment