473,396 Members | 1,879 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,396 software developers and data experts.

Currency Format In Textbox

Joe
Hi,

I am storing a field in SQL Server with a datatype of money.
When I pull that field back into my VB.NET client program, I put it
into a typed dataset with a field type of System.Decimal.

When it displays in the textbox that I have tied to the
dataset, it appears as 4000.0000 but I want it to appear as $4,000.00

How can I achieve this format in my textbox? Remember that
the underlying field is a Money datatype and not a string datatype.
J
Feb 10 '08 #1
3 5944
"Joe" <de*******@cox.netwrote in message
news:c8**********************************@p69g2000 hsa.googlegroups.com...
Hi,

I am storing a field in SQL Server with a datatype of money.
When I pull that field back into my VB.NET client program, I put it
into a typed dataset with a field type of System.Decimal.

When it displays in the textbox that I have tied to the
dataset, it appears as 4000.0000 but I want it to appear as $4,000.00

How can I achieve this format in my textbox? Remember that
the underlying field is a Money datatype and not a string datatype.
J
Couple of options I can think of:
1. Use data binding. This allows for optional formatting of the text box
2. Use the CONVERT function in Sql eg SELECT CONVERT(MyMoney, varchar) AS
MyMoney

If you use the second option, you will have to lookup the CONVERT function
in Sql. The above example returns two decimal places by default. There is a
third parameter for the CONVERT function that alters output.
Feb 10 '08 #2
Joe,

Have you ever looked at the masked textbox.

http://msdn2.microsoft.com/en-us/lib...edtextbox.aspx

Cor

"Joe" <de*******@cox.netschreef in bericht
news:c8**********************************@p69g2000 hsa.googlegroups.com...
Hi,

I am storing a field in SQL Server with a datatype of money.
When I pull that field back into my VB.NET client program, I put it
into a typed dataset with a field type of System.Decimal.

When it displays in the textbox that I have tied to the
dataset, it appears as 4000.0000 but I want it to appear as $4,000.00

How can I achieve this format in my textbox? Remember that
the underlying field is a Money datatype and not a string datatype.
J
Feb 11 '08 #3
Me.UnitPriceMaskedTextBox.Text = Format(Val(Me.UnitPriceMaskedTextBox.Text),
"c2")

Tony K

"Cor Ligthert[MVP]" <no************@planet.nlwrote in message
news:7A**********************************@microsof t.com...
Joe,

Have you ever looked at the masked textbox.

http://msdn2.microsoft.com/en-us/lib...edtextbox.aspx

Cor

"Joe" <de*******@cox.netschreef in bericht
news:c8**********************************@p69g2000 hsa.googlegroups.com...
>Hi,

I am storing a field in SQL Server with a datatype of money.
When I pull that field back into my VB.NET client program, I put it
into a typed dataset with a field type of System.Decimal.

When it displays in the textbox that I have tied to the
dataset, it appears as 4000.0000 but I want it to appear as $4,000.00

How can I achieve this format in my textbox? Remember that
the underlying field is a Money datatype and not a string datatype.
J
Feb 19 '08 #4

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

Similar topics

4
by: Patrick J. Schouten | last post by:
I am new to ASP/VBScript and I am trying to format a texbox when a user exits it. In Visual Basic you could put the following in the Exit property of the textbox: textbox1 = Format(textbox1,...
1
by: J.J. | last post by:
Hi, i have in my table/form two fields, first is number_field(decimal) and second is combo with two values from other table(USD and EURO). now i want that after i select USD the number_field is...
4
by: Gerry Abbott | last post by:
Hi All. How can i put a zero decimal for my currency into my format statement, == & ", for " & & " days. Cost " & Format(,"Currency") which is the data source for a textbox on a report
3
by: Scott Gorman | last post by:
I have created a report in access. I had to add a text box to input a value for previous months balance. I have formatted to display with $ currency, and also with the " , " for thousand separator....
3
by: Claudia Fong | last post by:
Hi, My db is stored in access and I have a field amount and its type is currency. When I read from the db and display it in a textbox, it shows me 15000000 instead of $150,000.00. How can...
2
by: Juan | last post by:
I get a number from db and display it in a textbox control, how can i format the value as currency? thanks, Juan.
5
by: cwbp17 | last post by:
Hi all, Have a datagrid that displays the price column of a table. Went to the Datagrid's Property builder and set the 'Data Formatting expression' for the PRICE column to {0:c}, so that the...
3
by: mracuraintegra | last post by:
I am seriously at my wits' end here with this. I've got a textbox bound to a money column in a database, but it shows up as a decimal value, meaning that $9.25 shows up as 9.250000. ARRRRG. ...
1
by: sijugeo | last post by:
Hi all, Myself having a textbox which is indented to enter the Currency of a particular good, and its working fine. Now the problem is , I want to format the way...
1
by: =?Utf-8?B?eXVyaWtz?= | last post by:
Hey, I'm building a business application that needs input of currency data. I looked a lot around google and friends for a good custom control to provide interactive validation and formatting of...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.