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

Newby textbox format question

Hi:

I'm very new to vb.net and I apologize if this question should have been
found in the documentation however I don't understand the documentation.

I have a textbox on a vb.net web form that I need to load with a price - for
example $1.23

The code:

tbxPrice.text = prodprice.tostring

produces an entry of 1.2300 in the textbox

Is there a simple way for format this to display and only allow two
decimals - $1.23? I have looked at the format documentation and it doesn't
make sense.

Your help is greatly appreciated!

Fred
Nov 20 '05 #1
4 6390
To allow two decimales

myTextBox.Text = String.format("{0:F2}", myValue)

to do it with a currency

myTextBox.Text = String.format("{0:c}", myValue)

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:eE**************@TK2MSFTNGP10.phx.gbl...
Hi:

I'm very new to vb.net and I apologize if this question should have been
found in the documentation however I don't understand the documentation.

I have a textbox on a vb.net web form that I need to load with a price - for example $1.23

The code:

tbxPrice.text = prodprice.tostring

produces an entry of 1.2300 in the textbox

Is there a simple way for format this to display and only allow two
decimals - $1.23? I have looked at the format documentation and it doesn't make sense.

Your help is greatly appreciated!

Fred

Nov 20 '05 #2
To allow two decimales

myTextBox.Text = String.format("{0:F2}", myValue)

to do it with a currency

myTextBox.Text = String.format("{0:c}", myValue)

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:eE**************@TK2MSFTNGP10.phx.gbl...
Hi:

I'm very new to vb.net and I apologize if this question should have been
found in the documentation however I don't understand the documentation.

I have a textbox on a vb.net web form that I need to load with a price - for example $1.23

The code:

tbxPrice.text = prodprice.tostring

produces an entry of 1.2300 in the textbox

Is there a simple way for format this to display and only allow two
decimals - $1.23? I have looked at the format documentation and it doesn't make sense.

Your help is greatly appreciated!

Fred

Nov 20 '05 #3
CJ:

Now I get it - thank you very much!

Fred

"CJ Taylor" <cege at remve this part tavayn yeah this part too dot com>
wrote in message news:Oi**************@TK2MSFTNGP10.phx.gbl...
To allow two decimales

myTextBox.Text = String.format("{0:F2}", myValue)

to do it with a currency

myTextBox.Text = String.format("{0:c}", myValue)

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:eE**************@TK2MSFTNGP10.phx.gbl...
Hi:

I'm very new to vb.net and I apologize if this question should have been
found in the documentation however I don't understand the documentation.

I have a textbox on a vb.net web form that I need to load with a price -

for
example $1.23

The code:

tbxPrice.text = prodprice.tostring

produces an entry of 1.2300 in the textbox

Is there a simple way for format this to display and only allow two
decimals - $1.23? I have looked at the format documentation and it

doesn't
make sense.

Your help is greatly appreciated!

Fred


Nov 20 '05 #4
CJ:

Now I get it - thank you very much!

Fred

"CJ Taylor" <cege at remve this part tavayn yeah this part too dot com>
wrote in message news:Oi**************@TK2MSFTNGP10.phx.gbl...
To allow two decimales

myTextBox.Text = String.format("{0:F2}", myValue)

to do it with a currency

myTextBox.Text = String.format("{0:c}", myValue)

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:eE**************@TK2MSFTNGP10.phx.gbl...
Hi:

I'm very new to vb.net and I apologize if this question should have been
found in the documentation however I don't understand the documentation.

I have a textbox on a vb.net web form that I need to load with a price -

for
example $1.23

The code:

tbxPrice.text = prodprice.tostring

produces an entry of 1.2300 in the textbox

Is there a simple way for format this to display and only allow two
decimals - $1.23? I have looked at the format documentation and it

doesn't
make sense.

Your help is greatly appreciated!

Fred


Nov 20 '05 #5

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

Similar topics

9
by: Damien | last post by:
I have just built a simple stopwatch application, but when i f5 to get things goings i get this message, An unhandled exception of type 'System.ArithmeticException' occurred in...
2
by: Joe | last post by:
I want to select a bunch of email addresses from a mysql table and format them to use with a php mail() function. I can select them from the database, but how do I format them so there's a comma...
20
by: Jack Schitt | last post by:
I thought I was starting to get a handle on Access, until I tried doing something useful...now I'm stuck. I have a DB with two tables - to keep it simple I'll say that one is an Employee File...
10
by: Fred Nelson | last post by:
Hi: I have programmed in VB.NET for about a year and I'm in the process of learing C#. I'm really stuck on this question - and I know it's a "newby" question: In VB.NET I have several...
10
by: John Baker | last post by:
Hi: This is the only ASP newsgroup I can access using Verizon, and I would like to know a real basic piece of information. I am totall new to ASP, although I have done HTML coding. Say I The...
4
by: Fred Nelson | last post by:
Hi: I'm very new to vb.net and I apologize if this question should have been found in the documentation however I don't understand the documentation. I have a textbox on a vb.net web form that...
3
by: Aaron Smith | last post by:
I found an quick and dirty example of a numeric text box that converts the string to a currency mask.. Here is the code: Public Class NumericMaskedTextBox Inherits System.Windows.Forms.TextBox ...
2
by: Fred Nelson | last post by:
Hi: I'm working on a VS2005 web application and I have what is probabably a "newby" question. In VS2003 I could drag a textbox/button/etc on to a form and position it with the mouse. I...
2
by: Adam Honek | last post by:
I have a form. It has serveral text boxes for user data entry. I could of course write code to check if each is empty before proceeding to save this data to a file. Is there any global way...
9
by: Mark G. | last post by:
Good afternoon. I have a "Fixed/2" format applied to a textbox on its property sheet. When I type data in the textbox, it is formatted correctly. But when I update the value programatically by...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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,...

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.