Text Box Currency Valiation code - Text box will allow only 9999.99
Text Box Currency Valiation code - Text box will allow only 9999.99
Rate Text Box Currency Valiation code - Text box will allow only 9999.99
(1(1 Vote))
'Place following code to form
Private Sub txtAmount_KeyPress(KeyAscii As Integer)
If Len(txtAmount.Text) > 14 Then
KeyAscii = 0
End If
If KeyAscii = 8 Then
Exit Sub
End If
If InStr(1, txtAmount.Text, ".") <> 0 And KeyAscii = 46 Then
KeyAscii = 0
ElseIf InStr(1, txtAmount.Text, ".") <> 0 And (KeyAscii > 47 And KeyAscii < 58) Then
If Len(Mid(txtAmount.Text, (InStr(1, txtAmount.Text, ".") + 1))) >= 2 And txtAmount.SelStart >= InStr(1, txtAmount.Text, ".") Then
KeyAscii = 0
End If
Else
If (KeyAscii > 47 And KeyAscii < 58) Or KeyAscii = 8 Or KeyAscii = 46 Then
Else
KeyAscii = 0
End If
End If
End Sub
Text Box Currency Valiation code - Text box will allow only 9999.99 Comments
No comments yet — be the first to post one!
Post a Comment