DataGridView using the DefaultCellStyle property does not display decimals

Source: Internet
Author: User

In the database is the numeric (38,6) type, shown to the DataGridView interface is always followed by 6 0 (for example: 20000.000000), want to just display integers, a burst of easy to find, but no detailed documentation comments, and some in the format string with the # symbol (such as: ##.##), do not know what to do. can do so.

      DataGridView dgvdiscipline= this as DataGridView;      dgvdiscipline.columns["anticipatingincome"]. defaultcellstyle.format="0";

An integer is displayed on the interface. If you also want to display in thousands of points (for example, 2755555.000000000 needs to be shown as 2,755,555.0000). Can do this:

      DataGridView dgvdiscipline= this as DataGridView;      dgvdiscipline.columns["anticipatingincome"]. defaultcellstyle.format="N4";

n represents a thousand-digit display, and the number after n indicates that several digits are retained after the decimal point. Only as a catalyst, hope to be useful.

Reference from StackOverflow Quiz

DataGridView using the DefaultCellStyle property does not display decimals

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.