Solved

textbox formatting

Posted on 2004-09-09
6
354 Views
Last Modified: 2010-04-17
hi

 in a form i have a texbox with is getting populated when page is displayed. it is displaying something as

12.0000.

but in the textbox i want only 12.00 ( with only two digits after decimal point to be displayed). how to format it.

thanks
sandeep
0
Comment
Question by:sandeep437
  • 2
6 Comments
 
LVL 5

Expert Comment

by:brianb99999
ID: 12022228
Depends on the language.
In MS Access or a bound control in other languages look for:
DataFormat or Mask or Format properties and modify these to #0.00

If it is not bound then when you get the data from wherever but before you assign it to the textbox use something like:
textboxname.text = format("12.0000", "#0.00")

Brian.
0
 

Author Comment

by:sandeep437
ID: 12022384
textboxname.text = format("12.0000", "#0.00")
is not working.

i working in vb.net.

can anybody tell formatting in vb.net
0
 
LVL 5

Accepted Solution

by:
brianb99999 earned 125 total points
ID: 12022579
= Format(CDbl("12.0000"), "#0.00")
0
 
LVL 5

Expert Comment

by:tzxie2000
ID: 12022959
code below
        Dim d As Double

        d = 12.0000
       textbox.Text = Format(d, "#0.00")
        Dim s As String
        s = "12.0000"
        textbox.Text = Format(CDbl(s), "#0.00")

if your input is an double variant use d mode
if your input is an string variant use s mode

all of them use format function
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about problems I had with the new location API and permissions in Marshmallow
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question