Format decimal places

I have the following expression

a3 = GetNomBal(period, "40011")

GetNomBal is a function which returns a "double" value, I want a3 to display at all times as with two decimal places, at the moment if the function returns 361.23 then a3 displays as 361.23 which is what I want, But if the value is say 200.00 then it displays 200

I tried

a3 = Format(GetNomBal(period,"40011"),currency) but got an error.

Can anyone help

Thanks :)

Ben Durkin

MCP MCSA MCSE, Currently learning VB.NET and ASP.NET

Burnley, England
5/16/2005 4:27:16 PM 91979 articles. 3 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 53

Try this, MyStr = Format(334.9, "###0.00");
My ASP.NET blog ~
God doesn't play dice...
5/16/2005 5:04:01 PM

Thanks for advice, I just tried

a3  = format(a3,"###0.00") but its still the same

Sad [:(]

Ben Durkin

MCP MCSA MCSE, Currently learning VB.NET and ASP.NET

Burnley, England
5/16/2005 5:45:04 PM

Hey, why are you again assigning the value to a3. I assume a3 is a double variable and you will lose the precision (if it is .00).

The Format() function returns a string. Assign that value to a string and your job is done. Alternatively, you could also use a3.ToString("###0.00"). But make sure you assign this value to a string.


My ASP.NET blog ~
God doesn't play dice...
5/17/2005 1:46:27 AM

Similar Artilces:

Formatting a decimal to 2 decimal places
Hi - just testing some code, and the code below returns a number with 3 decimal places (eg. 450.000). Will returning a decimal always give 3 decimal places, and if so, how can I remove the last one? I don't want to use: Return String.Format("{0:C}", decRunningTotal) - as that will automatically add a $ or £ or whatever to the start, and I'd like to control that. I'd really appreciate any help, thanks, Mark Function GetItemTotal() As String objDT = Session("Cart") Dim intCounter As Integer Dim decRunningTotal As Deci...

Formatting decimal places...
I have an application which pulls data (a currency amt) from an Access db. The number is a subtotal from a purchase. This number has 2 decimal places which is correct for currency. The application then performs some functions to display the tax amount and then another function to display the total amount due. The tax and total due figures both have 3 decimal places, obviously a result of the mathematical functions being performed on them. I am presenting these numbers in the form of a label on my form. I know this is silly but how can I present the tax and total due figures with only 2...

Getting Start With .net
hi i'm intersted to learn (vb or delphi) . i programming with delphi6 but i'd like to tp know something about programming in internet specially with .net . i hear about with delphi 7 that i can programming with delphi in .net .... is it right ? what 's our opinian about it ? and better to learn Vb.Net or continu with delphi(or thanks. Ali Darabian I think there is some support for Delphi in .Net. However, you will find much more support from the user community if you choose a more popular language such as VB.Net or C#. Since your al...

how to get start with .NET
the net help people installed  to my desktop 1-microsoft visual studio .NET enterprise developer 2003 2-microsoft .NET framework 1.1 what else do i need ...???  and how can i try with some simple code in VS.Net and run it to see wat happen...????? please help If you want to develope web applications, then you'll also need IIS on your PC.  That'll require XP-Professional or Windows 2000/2003, but XP-Home edition won't allow IIS installation. As for how to get started, you can search the web for some tutorials or buy a good book on VS.  The topic is way too vast to...

Where to start and how did you get started?
Hi, I have had a feeling for a long time to jump into the adds market for some time due to my low income (shooting for the stars) and I don't have anything better to do these days. But I find it really difficult not to give up due to lack of guides (what I can find atleast) and all the hard words which only makes me confused. But I won't give up. Never. Not sure if this is the right place to post this, but I deffinitly would be really greatfull for help getting started. How did you get started? +If there are any teacher that wanna show me the ropes private, I can give payment with ...

How to format a string of percentage format to decimal format ?
How to format a string of percentage format to decimal format ? 1    orginalValue  // value will be 1265.48 2    percentString // value after applying percentage format will be 126548 %3    requiredvalue // value should be 1265.48  I converted the string from orginalValue to percentString, now i need to convert back to requiredvalue. Is there any way to do ? regards, Ananth RM -  string percentString="126548 %";double value=double.Parse(percentString.Replace("%","").Tri...

How do I get started with AJAX.Net?
Hi All, I'm a seasoned developer but have not yet ventured into atlas et al.  I prefer books, but will take whatever I can get if it's good and will get me going. Any recommendations? Thx in advance. Jeff try here first then learn from sample and docJames Wu (MIB426).NET is only way to goMCP, MCSE, MCDBA, MCSD, MCAD I find the materials online display features and implementations but are lacking architectural depth, and am seeking more comprehensive resources. By architectural depth, I mean that I cannot watch ...

Getting started .net website
Hi folks,Does anyone here know of a good website to just sit back and read for learning .net? Thanks in advance.Baldeep Right here... Click the Get Started and Learn sections here. Quite a few out there - - this one, has a lot of good videos -  also, but then, I might be a little prejudiced David WierMCP/ - where to look first!Please Vote for ASPNet101 - 'Best Community Resource'!Control Grouper - easily control properties for multiple controls with one control!Calendar Express - The Best HTML Calendar Generator on the web!(P...

How to get 2 decimal places?
I have one session var and value of it will be double.How can i do it to be in 2 decimal places rounded up to nearest 5cents. eg.21.781 -> 21.10 21.322 -> 21.05 45 -> 45.00 Math.Round Method (Decimal, Int32, MidpointRounding)   Rounds a decimal value to a specified precision. A parameter specifies how to round the value if it is midway between two other numbers. Namespace: System Parameters d A decimal number to be rounded. decimals The number of significant decimal places (precision) in the return value. mode Specification for how to round d...

formating decimal places in a dataset
I am pulling a decimal value and then exporting it to a textfile. I know how to format if I was doing it on a webform - no prob, but pulling the info otherwise is causing me some problems and I was wondering if anyone can help Sample Code: Dim numberPlaceHolder as string Dim iLoop as int Dim dataSet1 as dataset .... fill dataset1 .... For iLoop = 0 To dataSet1.Tables("tmpDecimal").Rows.Count - 1 numberPlaceHolder = dataSet1.Tables("tmpDecimal").Rows(iLoop).Item(1) Next the numberPlaceHolder needs to be formate...

Getting Started with .net and a few questions
Hello I've done some asp and php programming along with various other languages in the past and slowing getting my head around .net.I have a small project of creating a Holiday Booking system on our Intranet and just trying to get the first part to work properly will hopefully get me sorted for the whole project. The Intranet is running on .net 2 and I prefer to use the VB code rather than C#. This is connecting to an SQL server.My initial page that I am trying to create is just for an admin user to view which dates in a table have been specified as Bank Holidays and be able to add ...

Getting started with JScript.NET
I'm a Javascript and Actionscript developer, and the thought of being able to do server-sides in something I know was too good to resist. Does anyone know some good tutorials for developing ASP.NET pages in JScript?  I can find lots of console code, but simple things are hard: like I can't even figure out how to print something out to the web page (just a string). What I'm really trying to do is access a database, verify a login, and print JSON out to the response.  What should I do to start?  Is there a better way to do this? (IE: using some JSON library already?). I'm commun...

plz Help: Converting 4 decimal places to 1 decimal place
Hi,I would like to convert 4decimal places to single(1) decimal place.For that i wrote below code. Its working sometimes. ex1:Input: StrAnlPct = "3.0000,2.9833,3.6546,4.65+6,5.54986,81.dsfds"Output: "3.0,2.9,3.6,4.6,5.5,81.d"For first example its working,Ex2:Input: StrAnlPct = "476290.4762,120.0000"For this i m getting error. Error is:    "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: startIndex "And    Source Error: At Line 590Line 588:            &...

Format the value to Two places of Decimal
With the following code I am unable to display the value of sSI in 2 places of decimal. Could you please let me know how to display the value in 2 places of decimal <div id="ScheduleInterchange" style="POSITION: relative"> <FONT style="FONT-SIZE: 10pt; COLOR: #330099; FONT-FAMILY: Arial"> Sch</FONT></a><span id="aceScheduleInterchange">Calculating Ace</span> <FONT style="FONT-SIZE: 12pt; COLOR: #330099; FONT-FAMILY: Arial"> ...

Web resources about - Format decimal places -

Penny (Irish pre-decimal coin) - Wikipedia, the free encyclopedia
The penny (1d) ( Irish : pingin ) coin was the third smallest denomination of the pre-decimal Irish pound , worth 1/240 of a pound or 1/12 of ...

Dewey Decimal Classification - Wikipedia, the free encyclopedia
This highly organized system categorizes books on library shelves in an efficient, specific and repeatable order that makes it easy to find any ...

Decimal Rounding on the App Store on iTunes
Get Decimal Rounding on the App Store. See screenshots and ratings, and read customer reviews.

Dewey Decimal Tattoo - Flickr - Photo Sharing!
Children's librarians represent.

Math of the Day: Sesame Street’s The Count Reads Pi to 10,000 Decimal Places
... has created a true monster out of your favorite Sesame Street vampire, with audio of The Count reading every digit of Pi out 10,000 decimal ...

Paul Harapin heads Decimal Software after VCE ousting
Former VCE Asia-Pacific boss, Paul Harapin, has taken over as CEO of Decimal Software.

Feeling green: the dangers of decimal currency
The curious case of possibly toxic coins, via Austria and a devastatingly original idea for Canberra.

Jobless Rates With Another Decimal
The BLS reported a jobless rate of 8.3% for both January and February. Adding an extra decimal, the unemployment rates would actually be 8.26% ...

JPMorgan Sued by Trader Over $3 Million Decimal Point
JPMorgan Chase & Co. is being sued by a trader who says he accepted a contract from the investment bank because a typographical error made him ...

.Decimal Archive - Houston Gamer
It was only back in August when newly-formed Houston game studio Orb Interactive launched a Kickstarter campaign for “.Decimal”, a sci-fi take ...

Resources last updated: 12/15/2015 7:12:35 PM