Number Formatting

T

thomson

Hi all,
i do have a Text Box for Amount , Almost all my forms are
dealing with Amounts, In My Setup I specify that only 2 decimals are
allowed , in all the amounts,

How do i set this Information In all My text Boxes which is dealing
with amount to accept only 2 decimals


Thanks In Advance

Thomson
 
J

jeff_carver

Here are a couple of possibilities:

txtAmt.Text = String.Format("{0:#0.00}", 456.9862) ' 456.99

- or take advantage of system locale settings:

txtAmt.Text = String.Format("{0:c}", 456.9862) ' $456.99

The "c" means "format as currency"; if the locale is U.S., then the
currency format will default to two decimal places and a leading dollar
sign.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top