473,383 Members | 1,815 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,383 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 6389
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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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...

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.