Wrox Programmer Forums
|
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 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 20th, 2008, 07:03 AM
Authorized User
 
Join Date: Feb 2008
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default Formatting numbers in vb.net

Dear all,

I want to know whether there is any function which satisfies my below condition.
dim i as integer
format(i,"0000") should return "0001" if i =1.
format(i,"0000") should return "0010" if i=10.
format(i,"0000") should return "0100" if i=100.

is there any function of that type..

Regards,



A M RAGHU
 
Old February 20th, 2008, 07:10 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

i.ToString("0000")

/- Sam Judson : Wrox Technical Editor -/
 
Old February 20th, 2008, 07:10 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

or String.Format("{0:0000}", i)

/- Sam Judson : Wrox Technical Editor -/
 
Old February 20th, 2008, 07:29 AM
Authorized User
 
Join Date: Feb 2008
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot guys....:)

A M RAGHU





Similar Threads
Thread Thread Starter Forum Replies Last Post
formatting phone numbers xslt_student XSLT 0 August 7th, 2006 04:10 PM
HOW TO COMPARE NUMBERS IN VB, PLEASE HELP chasey1 Beginning VB 6 1 June 24th, 2006 09:52 AM
formatting of a word document with vb.net krmilburn General .NET 0 April 18th, 2006 06:47 AM
Formatting numbers keso VB.NET 3 April 6th, 2006 04:42 AM
VB Numbers Mebbage XSLT 1 January 24th, 2005 06:05 AM





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