Solved

textbox formatting

Posted on 2004-09-09
6
356 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 …

734 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