LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.dotnet.framework,microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default NumberFormatInfo and Custom Numeric Format Strings

Does anyone know how to initialize a NumberFormatInfo instance with a custom
numeric format string?

So instead of directly using the custom numeric format string

double dVal = 19.95;
string strVal = dVal .ToString("$#,##0.00");
// - strVal is $19.95

I would like to first initialize the NumberFormatInfo instance:

NumberFormatInfo mobjNumFormat = NumberFormatInfo.CurrentInfo.Clone();
mobjNumFormat.InitWithCustomFormat("$#,##0.00");
string strVal = dVal.ToString("C",mobjNumFormat))

Cheers, Ralf

--
Dipl.-Ing. Ralf Steinstraesser
Software Architekt
Bissantz & Company GmbH

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
find and replace numeric strings in larger text strings Mr Molio Excel Worksheet Functions 8 November 9th 11 05:17 PM
CSV and Numeric Strings with Leading Zeros Ed Ardzinski Excel Worksheet Functions 2 February 21st 08 09:33 PM
Can I convert numeric 0510 to time 05:10 by custom cell format? Rita_H Excel Discussion (Misc queries) 4 July 27th 06 01:41 PM
How do I compare two arrays of numeric strings? john.jacobs71 Excel Programming 4 December 17th 05 04:59 PM
Converting variable text strings to numeric Richgard53 Excel Discussion (Misc queries) 1 July 13th 05 06:22 AM


All times are GMT +1. The time now is 06:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"