Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 248725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:22:01+00:00 2026-05-11T21:22:01+00:00

how to limit text to 6 numbers . 2 numbers ? (######.##) thank’s in

  • 0

how to limit text to 6 numbers . 2 numbers ?

(######.##)

thank’s in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T21:22:01+00:00Added an answer on May 11, 2026 at 9:22 pm

    You can use either the String.Format method or the ToString method:

    double value = 123.456;
    string formatted1 = String.Format(CultureInfo.InvariantCulture, "{0:######.##}", value);
    string formatted2 = value.ToString("######.##", CultureInfo.InvariantCulture);
    

    If you use # in the formatting string, those will be filled with spaces if there are no significant digits there. For example 123.456 formatted using "######.##" will be " 123.46".

    If you use 0 in the formatting string, those will be filled with zeroes of there are no significant digits there. For example 123.456 formatted using "000000.00" will be "000123.46".

    You can combine # and 0 to get different results. For example you might want spaces before the decimal separator, but always at least one digit: "#####0.00".

    The period character is used to specify the decimal separator. This is a period for some culture settings and a comma for other. You always use the period in the format string, but the output depends on the culture settings. If you always want a period in the output you can use the CultureInfo.InvariantCulture culture.

    If you don’t want the number to be rounded, you have to truncate it before formatting it:

    double value = 123.456;
    value = Math.Truncate(value * 100.0) / 100.0;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Without using jQuery, what is the best way to limit text entry of a
Is there a way to hide the text limit line in netbeans 6.5?
A Text field ( SPFieldText ) has a limit of 255 characters. What, if
What is the best way to limit the amount of text that a user
How can a fixed character limit be imposed on a text field in Cocos2d?
Im using thess functions to limit titles to 3 words: function trim_words(text, limit){ var
I have an text input. I wanna limit number of its character downto 300.
I have a few areas on my site where I need to limit text
I'm wanting to put a text on the web with paragraph numbers and sidenotes.
Possible Duplicate: How to limit number of characters per line in text area to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.