0

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

enter image description here

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;
    }
GOPI
  • 1,042
  • 8
  • 30

1 Answers1

1

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')
Archlight
  • 2,019
  • 2
  • 21
  • 34
  • instead of numeric notation i want to display the real value on the lc value with - ve or + ve value – GOPI Mar 05 '14 at 07:04
  • Check out this change. That should get you fixed – Archlight Mar 05 '14 at 07:28
  • what the purpose of ToString("F50") and TrimEnd("0".ToCharArray()) – GOPI Mar 05 '14 at 08:33
  • Hehe, convultet nonsensical c# syntax. ToString("FXXX") generates the non scientific value where xxx is the number of values after the dot(.) but then you get -9.012300000000 and you most often you want to strip the last zeroes away. And thats what TrimEnd does. But you can do .TrimEnd('0') – Archlight Mar 05 '14 at 09:16