Wrox Programmer Forums
|
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics 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 April 22nd, 2006, 10:56 PM
Registered User
 
Join Date: Apr 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Formating Floating point

Hi,

I try to format the output as 2 decimal place but result is
Multiplication test ... (0:n2)

Pls advise what went wrong. Code at end of msg.

Thanks & Regards,
Khiu

.................................................. ...
Private Sub btnIntMath_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnIntMath.Click
        'Declare variable
        Dim intNumber As Single

        intNumber = 12
        intNumber /= 7
        MessageBox.Show("Multiplication test ..." & String.Format("(0:n2)", intNumber), _
        "Floating point")

 
Old April 26th, 2006, 05:29 PM
Registered User
 
Join Date: Apr 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Simply write the format specifier as {0:n2} and not in parenthesis.

 
Old April 26th, 2006, 08:36 PM
Registered User
 
Join Date: Apr 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank alot.

Its is working now.

RGD





Similar Threads
Thread Thread Starter Forum Replies Last Post
Floating toolbar in WPF mani85 C# 0 August 6th, 2007 03:37 AM
Help Floating Point Accuracy righty Java Basics 0 January 28th, 2007 12:35 AM
Comparing floating point variables patpicos BOOK: Beginning Java 2, JDK 5 Edition 0 February 1st, 2005 12:37 AM
Is there "Floating ToolBar" concept in C# ? kishore_peddi C# 1 April 15th, 2004 01:58 AM
A weird problem with floating point ? tzecheung Javascript 1 June 25th, 2003 06:32 AM





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