473,378 Members | 1,420 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,378 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 40395
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,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.