Re: Numeric Entry into a EditBox
Posted: Thu Oct 25, 2018 8:26 pm
You could take a look at the following, where there are a couple of solutions. The basic work has been done but a few amendments needed, they seem to work quite well.
Purearea.net/pb/english.index.htm
Purearea.net/pb/english.index.htm
Code: Select all
, Content - English Overview, Maths, Check
Two that may help are :
IsAlpha&IsNumeric.pb and Numeric_Check.pb
I'm not sure about the detail on your application but presume you are storing results into a database and I don't want to teach you to suck eggs. But this may help someone, sometime.
From my experience for any number handling I always convert results to Integers. (or Long etc depending on the language etc) I'll usually do the maths using decimal numbers, store the numbers used and save the calculated result into a table as Integers. I will then string handle the decimal point for reports and will avoid the problems and pain from results truncated from 12 to 16 decimal places that can result in different totals when adding many numbers.
Presumably each individual field will have a specific number of decimals, two or three so it is easy enough to write a function to display the actual decimal resulting number correctly. Adding up Float or Double numbers can often produce different results, which, say in a financial package just isn't acceptable. Totals on invoices or statements just cannot be a penny out! Integer calculations will avoid this problem. Adding integers and then placing the decimal point in the total will always show the same result.
Regards, C87