473,320 Members | 1,850 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,320 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 6385
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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
1
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.