473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Formating money for display in a textbox

I have a textbox that displays money, I cannot find out how to format it so
it displayes like '$123.00' what i get now is '123.00'. Can someone point me
in the right direction?

Thanks in advance!!!
--
Norm Bohana
Nov 27 '05 #1
7 40401
nbohana wrote:
I have a textbox that displays money, I cannot find out how to format
it so it displayes like '$123.00' what i get now is '123.00'. Can
someone point me in the right direction?


myvalue.ToString("C");

http://msdn.microsoft.com/library/en...matstrings.asp
--
Chris Priede

Nov 27 '05 #2
Chris thanks for you help on this problem. I have been working on something
else and now I am back to this problem. The number add up ok but do not
format, what am I missing!! please help.

xnum = double.Parse(lcost); ***** this is passed in *******
ynum = double.Parse(txtServiceCost.Text); ***** this is in the textbox *****
znum = xnum + ynum;
znum.ToString("C");

--
Norm Bohana
"Chris Priede" wrote:
nbohana wrote:
I have a textbox that displays money, I cannot find out how to format
it so it displayes like '$123.00' what i get now is '123.00'. Can
someone point me in the right direction?


myvalue.ToString("C");

http://msdn.microsoft.com/library/en...matstrings.asp
--
Chris Priede

Dec 21 '05 #3
What are you assigning your formatted currency to?

With your code:

xnum = double.Parse(lcost); ***** this is passed in *******
ynum = double.Parse(txtServiceCost.Text); ***** this is in the textbox
*****
znum = xnum + ynum;
txtResult.Text = znum.ToString("C");
ToString() is a method and it returns a string value in the format of a
currency. You have to put that string somewhere though!

Steven Nagy

Dec 21 '05 #4
Steve, I am new to this kind of code, and stuck on stupid. Can you please
give me and example!! Thanks.
--
Norm Bohana
"Steven Nagy" wrote:
What are you assigning your formatted currency to?

With your code:

xnum = double.Parse(lcost); ***** this is passed in *******
ynum = double.Parse(txtServiceCost.Text); ***** this is in the textbox
*****
znum = xnum + ynum;
txtResult.Text = znum.ToString("C");
ToString() is a method and it returns a string value in the format of a
currency. You have to put that string somewhere though!

Steven Nagy

Dec 21 '05 #5
Um, I did in my previous posting... ?

If 'znum' is a double, and 'txtResult' is the text box where you want
to put your formatted result, then you need this line:

txtResult.Text = znum.ToString("C");

Is this what you ment?

Steven Nagy

Dec 22 '05 #6
Thanks Steven!!
--
Norm Bohana
"Steven Nagy" wrote:
Um, I did in my previous posting... ?

If 'znum' is a double, and 'txtResult' is the text box where you want
to put your formatted result, then you need this line:

txtResult.Text = znum.ToString("C");

Is this what you ment?

Steven Nagy

Dec 22 '05 #7
No worries. I'd always help someone with a cool name like 'Norm' !!!

Dec 22 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Polar | last post by:
I have a database that stories entries of short stories for a writers website. I can easily input the data into MYSQL but my trouble lies in retrieving the data. the story in just cut and...
6
by: Newbee Adam | last post by:
I have been reading in help how I need to use decimal becuase currency does not exist like I used in vb6. I had a difficult time on google and msdn finding how or if I can take the value of text...
3
by: Tom | last post by:
Is there any way to use conditional formating to change a control for a field in a continuous form to a textbox, option group or combobox depending on the value of another field on the form? On a...
2
by: Alberto | last post by:
I have a decimal field in a SQL Server DataBase who stores money and I want to show it in a TextBox and in a ListView controls in C#. If I do: txtMoney.Text = Convert.ToSingle(dr); I see...
4
by: djc | last post by:
Is there a property or method of the textbox web server control that I can use to format the text in it a certian way. For example I am displaying a date value from a database in a text box. It...
3
by: Tina | last post by:
I have a datagrid where I specified {0:###,###,###} at design time. However sometimes I am putting percentages in the grid instead of money and I want to change the formating to {##%}. I've...
2
by: Dave Prouten | last post by:
Hi all, I am trying to format a textbox which is data bound to a datagrid using the following syntax txtReportDate.DataBindings.Add("Text", dvHistory, "Start Date") I need to display the...
0
by: Sam | last post by:
I am trying to use a Simple form with 3 fields from SQL NorthWind Database (Order Details Table with 3 Fields. - OrderId, ProductId and Unit Price). The Field Unit Price has a data type of 'Money...
3
progdoctor
by: progdoctor | last post by:
Friends.. i have a problem.. How to make an input textbox work as desktop application textbox (money format case)? For example: when i entry 99200 in the inputbox and then press enter/tab key,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.