By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,025 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

how to show the 2nd decimal point if it is a zero.

P: 22
Hi

I am struggling to find help for this problem. I want to have a string for a currency value, the problem is every time the value of the string is exact to 1 decimal place it only shows the first decimal and not the "0" for the second decimal
Example:
2.70
is displayed as 2.7
Is there someway I can force the variable to contain the second decimal place. I have tried using a string variable instead but when I come to add up the variables the 2nd decimal place goes missing again.

Frank
Apr 27 '07 #1
Share this Question
Share on Google+
2 Replies


P: 47
Hi

I am struggling to find help for this problem. I want to have a string for a currency value, the problem is every time the value of the string is exact to 1 decimal place it only shows the first decimal and not the "0" for the second decimal
Example:
2.70
is displayed as 2.7
Is there someway I can force the variable to contain the second decimal place. I have tried using a string variable instead but when I come to add up the variables the 2nd decimal place goes missing again.

Frank
Use Format Function like
Expand|Select|Wrap|Line Numbers
  1. txt1.text=format(txt1.text,"0.00")
  2.  
Apr 27 '07 #2

SammyB
Expert 100+
P: 807
or even easier, use FormatCurrency

Note, if you are using VB.NET, these functions are in the Strings method, so you say Strings.Format, etc.
Apr 27 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.