equivalent for vb6.Format function in vb.net witho

2019-07-23 07:24发布

问题:

Possible Duplicate:
Is there a way to programmatically convert VB6 Formatting strings to .NET Formatting strings?

during migration from vb6 to vb.net the Format$(1234567, "###,###,###,###") function is converted to vb6.Format(1234567,"###,###,###,###") function, which is defined in Microsoft.Visualbasic.Compatibility.dll.

I dont want to use Microsoft.Visualbasic.Compatibility.dll. Is there any equivalent for this in .NET.

Thanks in advance.

回答1:

You can use the .ToString(string) method

Dim value As Integer = 1234567
value.ToString("###,###,###,###")

or the String.Format Method which uses Composite Formatting

String.Format("{0:###,###,###,###}", 1234567)