简体   繁体   中英

How to Convert The Display Format (Scientific notation to Double)

How to convert the scientific Notation in to Double..
Please kindly refer the image For your reference

在此处输入图片说明

on the header column i want to display the original "-" or "+" value i want to display not scientific notation how can i do this?
Coding Part

    private void clearAndLoadTree(AccountDetails account, TreeListNode parentNode)
    {
        treeDetails.Nodes.Clear();
        treeDetails.ClearNodes();
        populateTree(account, parentNode);
        treeDetails.ExpandAll();
    }

    private double populateTree(AccountDetails account, TreeListNode parentNode)
    {
        ArrayList al = new ArrayList();
        TreeListNode currentNode = addNode(account, parentNode);
        AccountDetails[] children = account.children;
        double lcValue = account.lcValue;
        if (children != null)
        {
            foreach (AccountDetails subAccount in children)
            {
                    lcValue += populateTree(subAccount, currentNode);
            }
        }

        currentNode.SetValue("lcValue", lcValue);
        return lcValue;
    }

    private TreeListNode addNode(AccountDetails account, TreeListNode parentNode)
    {
        TreeListNode node = treeAccount.AppendNode(null, parentNode);
        ******
        return node;
    }

This will do it.

Double.Parse("-1.668E-04", NumberStyles.Float, CultureInfo.InvariantCulture);

Edit

sorry misunderstod you a little there. The above does not work on larger numbers so then you need to do this instead.

var s = Double.Parse("-9.09494701772928E-13", NumberStyles.Float,CultureInfo.InvariantCulture);
var b = s.ToString("F50").TrimEnd("0".ToCharArray());

or

string c = s.ToString("F50").TrimEnd('0')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM