Keeping DBEdit value to 2 decimal point

How can I prevent the DBEdit from accepting more than 2 decimal points?
I have a situation that the DBEdit gets an amount like 2.675 and at exit, it gets rounded up to 2.68.
We need this to alert the user and not round the amount at exit, or not accept more than 2 decimal points to begin with. 

Any suggestion is appreciated.
0
Deborah
9/20/2012 9:31:57 PM
embarcadero.cppbuilder.ide 2180 articles. 1 followers. Follow

1 Replies
771 Views

Similar Articles

[PageSpeed] 16

what about regular expressions? 
^[0-9]*[.,]?[0-9]{0,2}$
I haven't test the expression so you have to find it by your self.

> {quote:title=Deborah Sassounian wrote:}{quote}
> How can I prevent the DBEdit from accepting more than 2 decimal points?
> I have a situation that the DBEdit gets an amount like 2.675 and at exit, it gets rounded up to 2.68.
> We need this to alert the user and not round the amount at exit, or not accept more than 2 decimal points to begin with. 
> 
> Any suggestion is appreciated.
0
Jan
9/21/2012 3:49:37 AM
Reply:

Similar Artilces:

How to validate a decimal value with 2 digits after decimal point (de decimal point is a comma)
  I am a newbee, I have a Textbox where de user must write the price of an object. How can I validate de data entry in the Textbox (it must be a valid decimal with 2 digits after decimal point), and my pages are in  Portuguese so the decimal point to be accepted must be a comma   thanks  well you can do something like followig:  suppose TextBox1.Text = 123456,789 then you can say if(TextBox1.Text.Contains(",") ) {     int index1 = TextBox1.Text.IndexOf(",") +1;     int index2 = TextBox1.Text.IndexOf(...

how do i keep a value with 2 integers following a decimal point?
 Hi All.I have a number like 0.50 i.e a value representing money in a double variable.However, it loses the last 0 and i am left with 0.5. I am using the formatCurrency function but still no luck. The problem is when i display the value stored, it only displays at 0.5 not 0.50. Any solutions?Thanks  How many parameters are you passing to FormatCurrency()? The second parameter, which is optional, specifies the number of decimal places to display. I looked here: http://msdn.microsoft.com/en-us/library/3352e6f5(VS.80).aspx Try FormatCurrency(moneyAmount, 2) Hope this helps. EDIT...

how to convert value with decimal point into value with decimal comma
Hello,  I like to know how I can change (for example) the value 55.55 into 55,55. (The system in my country is using comma's instead of points) I'm starting with  a string with the value "55.55" Then I will convert it to a double 55,55 Do I need the the system.Globalization namespace or is there just a simple solution?               Hi,If you are just going to use this format for display then it would be easy to do this:double dTemp;dTemp = 55.55;Response.Write(dTemp.ToString().Replace(".",","));H...

2 Decimal point value Problem..
Hi guys, Need help! How to create a DBF table with Floating Point column (2 Decimal Places) in Delphi code? Thanks. Regards, Eric coiner roy wrote: > Hi guys, > > Need help! > How to create a DBF table with Floating Point column (2 Decimal > Places) in Delphi code? Thanks. > > > Regards, > Eric Which Delphi version? Which Database components? No problems with creating other kinds of dbf-tables or columns? Tiedo -- ...

CompareValidator fail if currency value more than 2 decimal point
Does anyone encounter problem using the compare validator against a textbox with operator=DataTypeCheck, type="Currency" and the textbox value contains more than 2 decimal point? With type="Double" it works fine with more than 2 decimal point but must not have comma. Below is my test result: Currency 10,200.20 pass Currency 10,200.204 fail Double 10,200.20 fail Double 10200.204 pass Any suggestion to overcome this issue? Leon ...

how to round mumeric value upto 3 decimal points in asp 2.0
hi i want to rount numericvalues up to 3 dicimal points in asp 2.0, how can i achive this goal.   If you just want to show this value as string use:  x.ToString("0.000") - to show always three decimals (even they are zero) x.ToString("0.###") - to show only existing decimals - up to three.   If you need it as number - after string conversion - just use Decimal dec = Convert.ToDecimal(x.ToString("0.###"))   Code works in all ASP 2.0 languages Regards,Florin Antoci...

Storing values with more than 2 decimal places in a NUMERIC(9,2) field
With Interbase 7.5.1 I recently found that dbExpress (Delphi 7.1) allows to store more than two decimal places in a column which is defined as NUMERIC(9,2). Is this known behaviour? A related problem with dbExpress in Delphi is, that a record who uses more than 2 decimal places in this DECIMLA(9,2) column can not be edited in a data entry form which uses TSQLQuery and TClientDataSet: the ApplyUpdates method will fail with "record not found or modified by an other user". Best Regards -- Michael Justin SCJP, SCJA betasoft - Software for Delphi™ and for the Java™ ...

decimal point #2
------=_NextPart_000_001D_01C1A834.21827C90 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Hi, I am trying to move the decimal point 2 places to the the left. Eg : To make 4536233 into 45362.33 I tried this $total = "4536233"; $total = sprintf("%0.2f",$total); print "$total"; But I get this 4536233.00 Can anyone help please Regards Stuart Clark ------=_NextPart_000_001D_01C1A834.21827C90-- Dear Stuart, The Sprintf function may not be able to change the value of the scalar varia...

Generate 2 decimal points??? how?
HI All, I use MSSQL as my database and ASP.NET as my front application. I want to display Price value S$23.68. The dayatype I used is smallmoney, but it display: S$23.6800. HOw do I control the number of decimals point in the column of MSSQL??  Thanks a lot  Suigion Well for monetry values i use datatype Decimal(9,2)where 9 is the number of digits before Decimal and 2 is the number of digits that u can use after decimal Pointhope that might helps.....!!Gurpreet Singh Dhaliwal...

Using Data Values from 2 tables of a database to calculate an average of the 2 values
Hi all,I had a ChemDatasbase with 2 tables (LabData & LabResults) in the Sqlexpress server of my SQL Server Management Studio Express. In my VWD 2005 Express, I used DropDownList and GridView controls in the Default.aspx of my RPD-1 website to get the following output:          RPD-1 Output                   Label1: LabData-SampleID                  &n...

Problem with decimal point in datawindow #2
I have a problem with decimals in a datawindow. -When i use a decimal with editmask #0.00 or #0,00 the number i receive from the datawindow is not a decimal For ex.: dec (datawindow.Object.decimal[1]) = 165 (and not 16.5) I tried to change the settings in the registry in the beginning of my program, because the standard on my computer the decimal sign is a comma. So I change it in the program to a point and at the end of the program back to a comma . I also tried to use an edit field but then i have the same problem. What can i do about this? Thanks Glenn Whic...

Validate 2 digits after decimal point?
Hi, I am wondering what is the best approach to be able to validate a numeric field with 2 digits after the decimal point. Does anyone have a small snippet of code. I can't use the inbuilt validator controls of asp.net, as the textboxes would be generated on the fly. Thanks You can add validator controls on the fly, same as any other control.Jared LivingstonMrLivingston.com - Livingston Family WebsiteTest/Demo site - moonmark.com Hi, Thanks for the speedy reply. I am just trying to write this function, to which I pass the name of the textbox, the validation type such ...

How to display value rounded and with 2 decimal
Hi, I want to display values always with 2 decimals. Lets say I have a string OR Decimal variable that has value "500000", then I want to display it as "500000.00", or if its "500000.6655", I want to display it as "500000.66". I tried string.Format("0:C2") but its not working, can you tell me how can I format this value so that it always displays with two decimals. niravparekh:Lets say I have a string OR Decimal Numeric format strings do not work for Strings OR Numbers.  The value being formatted must be stored in a numeric ...

How to keep session between 2 domains pointing to the same account?
Hi, I have a problem that's driving me mad. I have a site with multiple domains pointed to it, and I have one secure certificate for one of the domains. So whenever there is sensitive data to be sent, I redirect to the secure domain. I am currently saving off the 'entry' domain in the Session_Start event of the global.asax, but when I redirect to the secure domain, my session is lost. is it possible to keep the session across the domains, since it's pointing to the same space? I'm not sure if this is clear enough, but if anyone out there could help me out, i'd appreciate it. Than...

Web resources about - Keeping DBEdit value to 2 decimal point - embarcadero.cppbuilder.ide

Watch Disrupt London Day One LIVE Right Here!
Disrupt London 2015 is now officially underway, after an incredibly successful Hackathon where FreeMe took home the main prize. Today, the conference ...

Doctors: Latest brain scan is good news for Jimmy Carter
ATLANTA (AP) — A recent MRI showing no cancer on Jimmy Carter's brain is "very positive" news for the former president but will not end his medical ...

France’s far-right National Front tops first round of regional vote
France’s far-right National Front (FN) party rode a wave of fear over immigration and terrorism to storm to a commanding position in the first ...

Laquan McDonald Shooting: Chicago Police Reports Offer Different Account From ...
Washington Post Laquan McDonald Shooting: Chicago Police Reports Offer Different Account From ... KTLA Chicago police reports on the fatal ...

What Would An Eight-Team College Football Playoff Have Looked Like In 2015?
College football fans are ready for an eight-team playoff. Just hours after the committee selected this year’s college football playoff teams, ...

As Silicon Valley Bank surges on loans to tech startups, its exposure to risky loans also rises
Wall Street Journal : As Silicon Valley Bank surges on loans to tech startups, its exposure to risky loans also rises — Silicon Valley's Hometown ...

SNL reveals the true aftermath of an alien abduction
Technically Incorrect: After the little green people have let you go, you have to reveal all to the NSA. That's not so easy.

‘Crippled America’ Shines Spotlight On Donald Trump’s Other Career
The Iowa Caucuses are less than 60 days away, and much to the chagrin of some, Donald Trump has maintained a comfortable lead on his competitors. ...

Go behind the scenes of the U.N. Climate Summit with 'Earth to Paris'
Now is the time to act. More than 40,000 diplomats, experts and advocates, including more than 135 world leaders, are currently in Paris to ...

Jerry Falwell Urges Liberty University Students To Arm Themselves And ‘End Those Muslims’
Liberty University President Jerry Falwell, Jr. urged students to arm themselves by getting their permits to carry concealed weapons while speaking ...

Resources last updated: 12/7/2015 9:22:58 AM