This function will allow only Currency in text boxed
This function will allow only Currency in text boxed
Rate This function will allow only Currency in text boxed
(2(2 Vote))
Private Sub txtCurency_KeyPress(KeyAscii As Integer)
KeyAscii = fnOnlyOrderCurrency(txtCurency, KeyAscii)
End Sub
'==================================
Public Function fnOnlyCurrency(objText As Object, intKP As Integer) As Integer
On Error GoTo LOCALERRORHANDLER
'To allow only Currency values 99999999.00
fnOnlyCurrency = intKP
If Len(objText.Text) > 12 Then
fnOnlyCurrency = 0
End If
If intKP = 8 Then
Exit Function
End If
If InStr(1, objText.Text, ".") <> 0 And intKP = 46 Then
fnOnlyCurrency = 0
ElseIf InStr(1, objText.Text, ".") <> 0 And (intKP > 47 And intKP < 58) Then
If Len(Mid(objText.Text, (InStr(1, objText.Text, ".") + 1))) >= 4 And objText.SelStart >= InStr(1, objText.Text, ".") Then
fnOnlyCurrency = 0
End If
Else
If (intKP > 47 And intKP < 58) Or intKP = 8 Or intKP = 46 Or intKP = 13 Then
Else
fnOnlyCurrency = 0
End If
End If
Exit Function
LOCALERRORHANDLER:
fnOnlyCurrency = 0
End Function
This function will allow only Currency in text boxed Comments
No comments yet — be the first to post one!
Post a Comment