equivalent for vb6.Format function in vb.net without using Microsoft.Visualbasic.Compatibility.dll [duplicate]

删除回忆录丶 提交于 2019-12-24 10:59:23

问题


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)


来源:https://stackoverflow.com/questions/14133762/equivalent-for-vb6-format-function-in-vb-net-without-using-microsoft-visualbasic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!