Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / March 2008

Tip: Looking for answers? Try searching our database.

convert int  to numeric (formatted) string

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
raulavi - 10 Mar 2008 19:55 GMT
vs2005 c#

hi:
need to convert a simple int to a format nnnn. if I have int 1 I want the
result to be padded with 0s as  0001 on a string

I have int 1 and I want "0001"

any help. Thanks

so far these dont work
field.ToString("nnnn") or field.ToString("####")
Jon Skeet [C# MVP] - 10 Mar 2008 20:19 GMT
> hi:
> need to convert a simple int to a format nnnn. if I have int 1 I want the
[quoted text clipped - 6 lines]
> so far these dont work
> field.ToString("nnnn") or field.ToString("####")  

"0000" works fine.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk

raulavi - 11 Mar 2008 15:42 GMT
Thanks this works.

> > hi:
> > need to convert a simple int to a format nnnn. if I have int 1 I want the
[quoted text clipped - 8 lines]
>
> "0000" works fine.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.