Kannan wrote:
I would like to add $ symbol in numeric amount. For that I have used
Microsoft.VisualBasic.Strings.Format(strAmount, "$0.00").
But it seems to me that I am using VisualBasic name space and my manager
wants to use .Net name space function instead of VisualBasic.
Why? Are you writing Visual Basic code or not?
If you are, then the /compiler/ will be using stuff from
Microsoft.VisualBasic under the covers - you're not saving or gaining
anything by ignoring the functionality that's provided for you.
If you want to go down that road, write in C#.
Is there is any function availble for this in .Net?
Well, yes, there is but, looking at your code, you need to be careful.
Imports VB = Microsoft.VisualBasic
Dim s as String _
= VB.Strings.Format( strAmount, "$0.00" )
You're relying on Evil Type Coercion to convert "strAmount" from a
String into a numeric value, before formatting it using a numeric
formatting pattern. AFAIK, none of the .Net methods will do this;
you'll have to do the conversion yourself, as in
Dim d as Double _
= CDbl( strAmount ) ' I know; I'm terrible :-)
Dim s as String _
= d.ToString( "$0.00" )
HTH,
Phill W.