Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 22nd, 2005, 09:13 AM
Authorized User
Join Date: Dec 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default formatting number


I have doone a program such that using xpath , to read data's from xml and display it on a form.

now for ex:

XPathExpression Expr2;
Expr2 = oXPathNav.Compile("/tmp_day_stats//td_value");

XmlNamespaceManager oxmlNSManager = new XmlNamespaceManager(oXPathNav.NameTable);
oxmlNSManager.AddNamespace("tmp_day_stats", "http://myserver/myschemas/tmp_day_stats");


XPathNodeIterator iterator2 = oXPathNav.Select(Expr2);
while (iterator2.MoveNext())
this.textBox2.Text.ToString += this.textBox2.Text == "" ? iterator2.Current.Value: "\r\n"+ iterator2.Current.Value;

the above program what it does uis that read all the values of td_value from the xml file and display them in the textbox2.

ie, the output is as follows


now i have to format these numbers as follows


ie, after decimal i should have only 2 values to be shown.
how to format it . please help me to get this..


Old February 24th, 2005, 11:59 AM
Friend of Wrox
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post

900909.87887 is converted to 900909.88

software student.
Old February 24th, 2005, 12:47 PM
Friend of Wrox
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post

string temp=a.ToString("R");
900909.87887 is converted to 900909.87

software student.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Number formatting / RegExp pierre.voisin Javascript 0 March 3rd, 2008 01:50 PM
Textbox Number Formatting pencilneck Visual Basic 2005 Basics 2 October 25th, 2007 03:46 PM
Problems with Number Formatting Roly Reefer Access 1 July 10th, 2005 02:00 PM
formatting number vkey XSLT 1 June 22nd, 2005 02:29 AM
Formatting a number eelisMX Pro VB.NET 2002/2003 7 January 28th, 2005 05:22 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.