|
-
Mar 13th, 2000, 03:38 AM
#1
Thread Starter
Junior Member
I am trying to find the best way to force a user to enter a currency amount. I have tried using the maskedit box but I find it unfriendly. For instance when you press the period it doesn't automatically go to the decimal portion of the currency amount.
Is there a better way?
-
Mar 13th, 2000, 04:06 AM
#2
If you want to avoid using the MaskEdit control tnen you can use a regular TextBox and restric the user to have only 2 (or whatever number) of decimal points there. Put this code on KeyPress event of that TextBox:
Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 8
Case 46
If InStr(Text1.Text, ".") Then KeyAscii = 0
Case Else
If Not IsNumeric(Chr(KeyAscii)) Then KeyAscii = 0
If InStr(Text1.Text, ".") Then
If Len(Mid(Text1.Text, InStr(Text1.Text, ".") + 1)) = 2 Then
KeyAscii = 0
End If
End If
End Select
End Sub
This will allow only Numbers, Decimal Point and Backspace.
-
Mar 8th, 2004, 11:01 AM
#3
New Member
CURRENCY,MASKEDIT
i trying to entering credit currency value (negative)from interface direct to database- , the problem is ,interface cannot accep negative valua. Any idea's?
-
Mar 8th, 2004, 11:03 AM
#4
Re: CURRENCY,MASKEDIT
Originally posted by v-kool
i trying to entering credit currency value (negative)from interface direct to database- , the problem is ,interface cannot accep negative valua. Any idea's?
What was the format set for negative number? -10 or (10)?
-
Mar 8th, 2004, 11:39 AM
#5
New Member
The format is -10 .(from interface) , but in database, (10) or -10
i prefer databse read -10 and the interface read -10.access and sql server6.0 ,
-
Mar 8th, 2004, 01:42 PM
#6
Click the Numberbox link in my signature. That will allow you to create an OCX that will restrict input to numerics and you can specify the maximum number of decimal places.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|