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 / Windows Forms / WinForm General / June 2006

Tip: Looking for answers? Try searching our database.

using format strings or the equivalent

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bob - 22 Jun 2006 06:57 GMT
Hi all,

I' like to now how to use formatting strings for certain or all methods in
.net ..

I keep coming across problems such as displaying a timespan and getting
hours, mins date and all the milliseconds

back in the old C days you could put together a format string in your good
old printf command ... and it seems you can do that in c# .. but apart from
a few set commands I cant find the mechanism that allows complete control
over the strings.

I thought methods such as myTimeSpan.ToString(" some format string ") ..
would be a good place to have them .. but alas ... and it also seems that
nto all the toString() methods seem to work the same.

sometime giving it a (T)  or a (C) is not enough control .... the .Net docs
are extensive and unless you already know what your looking for .... well
...

any starting points ... such things as "hh:mm:ss" .. or these sort of things
?

regards Bob
Mini-Tools Timm - 27 Jun 2006 15:30 GMT
> I' like to now how to use formatting strings for certain or all methods in
> ..net ..
[quoted text clipped - 10 lines]
> would be a good place to have them .. but alas ... and it also seems that
> nto all the toString() methods seem to work the same.

.NET has exactly what you are looking for with the ToString() method.  To
see the formatting strings, look in the documentation for the ToString()
method in the derived class.  e.g., to see how to format dates, look up the
"DateTime.ToString method" in the .NET documentation.

In addition, here is an handy reference on string formatting in .NET:

http://blog.stevex.net/index.php/string-formatting-in-csharp/

Signature

Timm Martin
Mini-Tools
.NET Components and Windows Software
http://www.mini-tools.com


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.